-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
40 lines (31 loc) · 990 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM ruby:3.4.1-slim
ENV APP_ROOT=/usr/src/app
ENV DATABASE_PORT=5432
WORKDIR $APP_ROOT
# * Setup system
# * Install Ruby dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
nodejs \
libpq-dev \
tzdata \
curl \
libyaml-dev \
libcurl4-openssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Will invalidate cache as soon as the Gemfile changes
COPY Gemfile Gemfile.lock .ruby-version $APP_ROOT/
RUN bundle config --global frozen 1 \
&& bundle config set without 'test' \
&& bundle install --jobs 2
# ========================================================
# Application layer
# Copy application code
COPY . $APP_ROOT
RUN bundle exec bootsnap precompile --gemfile app/ lib/
# Precompile assets for a production environment.
# This is done to include assets in production images on Dockerhub.
RUN SECRET_KEY_BASE=1 RAILS_ENV=production bundle exec rake assets:precompile
# Startup
CMD ["bin/docker-start"]