-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.local
56 lines (42 loc) · 1.78 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
53
54
55
56
# Builder Stage
FROM ruby:2.7.5-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 openssl && \
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 'development test' && \
bundle install -j"$(nproc)"
COPY package.json yarn.lock ./
COPY packages packages
RUN yarn install --frozen-lock
COPY . .
RUN bundle exec bootsnap precompile --gemfile app/ lib/ config/ bin/ db/ && \
bundle exec rails assets:precompile && \
bundle exec rails deface:precompile
run mkdir certificate-https-local
RUN openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=FR/ST=France/L=Paris/O=decidim/CN=decidim.eu" -keyout ./certificate-https-local/key.pem -out ./certificate-https-local/cert.pem;
# Runner Stage
FROM ruby:2.7.5-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"]