-
Notifications
You must be signed in to change notification settings - Fork 66
/
Dockerfile
68 lines (48 loc) · 1.76 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
FROM ruby:3.3.4-alpine AS builder
WORKDIR /app
ENV RAILS_ENV="production" \
BUNDLE_PATH="vendor/bundle" \
GEM_HOME="vendor/bundle"
ENV PATH="$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH"
COPY Gemfile Gemfile.lock package.json yarn.lock ./
RUN apk -U upgrade && \
apk add --no-cache build-base git nodejs yarn libc6-compat
RUN bundle config set --local without 'development test' && \
bundle config set no-cache 'true' && \
bundle install && \
rm -rf /app/vendor/bundle/cache/*.gem && \
mkdir -p tmp/pids
RUN node -v && \
yarn version
RUN yarn install && \
yarn cache clean
COPY . ./
RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails shakapacker:compile && \
SECRET_KEY_BASE_DUMMY=1 bundle exec rake assets:precompile
RUN yarn install --production && \
yarn cache clean
FROM ruby:3.3.4-alpine AS runner
WORKDIR /app
ENV RAILS_ENV="production" \
RAILS_SERVE_STATIC_FILES=true \
RAILS_LOG_TO_STDOUT=true \
RAILS_MAX_THREADS="1" \
WEB_CONCURRENCY="12" \
PORT="3000" \
ANALYTICS=true \
SECRET_KEY_BASE="" \
EXPLORER_API_KEY="" \
BUNDLE_PATH="vendor/bundle" \
GEM_HOME="vendor/bundle"
ENV PATH="$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH"
RUN apk add --no-cache bash net-tools bind-tools tzdata libc6-compat && \
adduser -h /app -H -s /bin/bash -D appuser && \
rm -rf /var/cache/apk/*
COPY --from=builder --chown=appuser /app /app
COPY --from=builder --chown=appuser /usr/local/bundle /usr/local/bundle
RUN chown appuser:appuser -R /app \
&& chmod +x /app/entrypoint.sh
USER appuser
EXPOSE "${PORT}"
ENTRYPOINT ["./entrypoint.sh"]
CMD ["bundle", "exec", "pumactl", "-F", "config/puma.production.rb", "-P", "tmp/pids/app.pid", "start"]