-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
70 lines (51 loc) · 1.74 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Stages
#
# debian:stable-slim
# -> base
# -> assets-builder
# -> final with COPY assets-builder/public/assets
# Create a production image for Chouette
#
# Usage (minimalist) :
# docker build -t chouette-core .
# docker run --add-host "db:172.17.0.1" -e RAILS_DB_PASSWORD=chouette -p 3000:3000 -it chouette-core
FROM eu.gcr.io/enroute-interne/enroute-ruby:2.7 AS base
WORKDIR /app
# Install bundler packages
COPY build.rc Gemfile Gemfile.lock ./
RUN build.sh docker::bundler::install
FROM base AS assets-builder
RUN build.sh apt::install::yarn
# Install yarn packages
COPY package.json yarn.lock ./
RUN build.sh yarn::install
# Install application file
COPY . ./
# Override database.yml and secrets.yml files
COPY config/database.yml.docker config/database.yml
COPY config/secrets.yml.docker config/secrets.yml
RUN build.sh docker::env::production
# Run assets:precompile
ARG SENTRY_AUTH_TOKEN
ARG VERSION
RUN build.sh docker::assets::precompile
FROM base AS final
# Install application file
COPY . ./
# Override database.yml and secrets.yml files
COPY config/database.yml.docker config/database.yml
COPY config/secrets.yml.docker config/secrets.yml
RUN build.sh docker::env::production
COPY --from=assets-builder /app/public/assets/ public/assets/
COPY --from=assets-builder /app/public/packs/ public/packs/
# Create version.json file if VERSION is available
ARG VERSION
RUN build.sh docker::version
RUN bundle exec bootsnap precompile --gemfile app/ lib/
VOLUME /app/public/uploads
EXPOSE 3000
ENV RAILS_ENV=production RAILS_SERVE_STATIC_FILES=true RAILS_LOG_TO_STDOUT=true
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
ENTRYPOINT ["./script/docker-entrypoint.sh"]
# Use front by default. async and sync 'modes' are available
CMD ["front"]