-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.local
52 lines (40 loc) · 1.52 KB
/
Dockerfile.local
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
41
42
43
44
45
46
47
48
49
50
51
52
# Builder Stage
FROM ruby:3.0.6-slim as builder
ENV RAILS_ENV=production \
SECRET_KEY_BASE=dummy
WORKDIR /app
RUN apt-get update -q && \
apt-get install -yq libpq-dev curl git libicu-dev build-essential && \
curl https://deb.nodesource.com/setup_16.x | bash && \
apt-get install -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
npm install --global yarn && \
gem install bundler:2.4.9
COPY Gemfile Gemfile.lock ./
RUN bundle config set --local without 'test' && \
bundle install -j"$(nproc)"
COPY package.json yarn.lock ./
COPY packages packages
RUN yarn install --frozen-lockfile
COPY . .
RUN bundle exec bootsnap precompile --gemfile app/ lib/ config/ bin/ db/ && \
bundle exec rails deface:precompile && \
bundle exec bin/webpack
# Runner Stage
FROM ruby:3.0.6-slim as runner
ENV RAILS_ENV=production \
SECRET_KEY_BASE=dummy \
RAILS_LOG_TO_STDOUT=true \
LD_PRELOAD="libjemalloc.so.2" \
MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:5000,muzzy_decay_ms:5000,narenas:2"
WORKDIR /app
RUN apt-get update -q && \
apt-get install -yq postgresql-client imagemagick libproj-dev proj-bin libjemalloc2 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
gem install bundler:2.4.9
COPY --from=builder /usr/local/bundle /usr/local/bundle
COPY --from=builder /app /app
EXPOSE 3000
CMD ["bundle", "exec", "rails", "server", "-b", "ssl://0.0.0.0:3000?key=/app/certificate-https-local/key.pem&cert=/app/certificate-https-local/cert.pem"]