-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
70 lines (49 loc) · 1.54 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
FROM ruby:3.1.3-alpine AS Builder
RUN apk add --update --no-cache \
build-base \
postgresql-dev \
imagemagick \
nodejs \
yarn \
git \
tzdata \
file
ENV RAILS_ENV production
ENV RAILS_BUILD_IN_PROGRESS yes
WORKDIR /app
COPY . .
RUN gem install bundler:2.4.7 && \
bundle config --local without 'development test' && \
bundle install -j4 --retry 3 && \
bundle clean --force && \
rm -rf /usr/local/bundle/cache/*.gem && \
find /usr/local/bundle/gems/ -name "*.c" -delete && \
find /usr/local/bundle/gems/ -name "*.o" -delete
RUN mv config/credentials/production.yml.enc \
config/credentials/production.yml.enc.bak 2>/devnull || true
RUN SECRET_KEY_BASE=dummy \
RAILS_MASTER_KEY=dummy \
NODE_OPTIONS=--openssl-legacy-provider \
rails assets:precompile
RUN mv config/credentials/production.yml.enc.bak \
config/credentials/production.yml.enc 2>/dev/null || true
RUN rm -rf .git node_modules tmp/cache vendor/bundle test spec
RUN mkdir -p tmp/pids
###########################################################
FROM ruby:3.1.3-alpine
RUN apk add --update --no-cache \
postgresql-client \
imagemagick \
tzdata \
file
ENV NODE_OPTIONS --openssl-legacy-provider
ENV RAILS_ENV production
WORKDIR /app
RUN addgroup -g 1000 -S app && \
adduser -u 1000 -S app -G app
COPY --from=Builder /usr/local/bundle/ /usr/local/bundle/
COPY --from=Builder --chown=app:app /app /app
EXPOSE 3000
USER app
ENTRYPOINT ["bin/docker-entrypoint.sh"]
CMD ["puma", "-C", "config/puma.rb"]