-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
76 lines (58 loc) · 1.77 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
71
72
73
74
75
76
FROM ruby:3.3.2-alpine AS build-env
ARG RAILS_ROOT=/usr/src/app
ENV BUNDLE_APP_CONFIG="$RAILS_ROOT/.bundle"
ENV RUBY_YJIT_ENABLE=1
RUN apk add --update --no-cache \
git \
build-base \
mysql-dev \
nodejs \
yarn \
tzdata \
&& rm -rf /var/cache/apk/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*\
&& gem update --system
WORKDIR $RAILS_ROOT
COPY package.json yarn.lock ./
RUN yarn install --pure-lockfile && yarn cache clean
COPY Gemfile Gemfile.lock ./
RUN bundle update --bundler \
&& bundle config --global frozen 1 \
&& bundle config set --local path 'vendor/bundle' \
&& bundle config --local without 'development test' \
&& bundle install --jobs 4 --retry 3 \
&& bundle clean --force \
&& rm -rf /usr/local/bundle/cache \
&& find vendor/bundle/ruby/3.3.0/gems/ -name "*.c" -delete \
&& find vendor/bundle/ruby/3.3.0/gems/ -name "*.o" -delete
COPY . .
ENV RAILS_ENV production
ENV NODE_ENV production
ENV RAILS_SERVE_STATIC_FILES true
ENV SECRET_KEY_BASE "precompile_placeholder"
RUN bin/shakapacker \
&& yarn cache clean \
&& rm -rf node_modules tmp/cache/* /tmp/* yarn.lock app/ui/* spec/*
FROM ruby:3.3.2-alpine
ARG RAILS_ROOT=/usr/src/app
ENV RAILS_ENV production
ENV NODE_ENV production
ENV RAILS_SERVE_STATIC_FILES true
ENV RAILS_LOG_TO_STDOUT true
ENV BUNDLE_APP_CONFIG="$RAILS_ROOT/.bundle"
ENV RUBY_YJIT_ENABLE=1
WORKDIR $RAILS_ROOT
RUN apk add --update --no-cache \
mysql-dev \
nodejs \
vips-dev \
nmap \
tzdata \
&& rm -rf /var/cache/apk/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY --from=build-env $RAILS_ROOT $RAILS_ROOT
RUN gem install foreman
# Add a script to be executed every time the container starts.
EXPOSE 8030
# Configure the main process to run when running the image
CMD ["bin/docker-run.sh"]