-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
51 lines (40 loc) · 1.64 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
FROM ruby:3.1.4-alpine3.18
ENV RAILS_ENV=production \
NODE_ENV=production \
RAILS_SERVE_STATIC_FILES=true \
RAILS_LOG_TO_STDOUT=true \
RACK_TIMEOUT_SERVICE_TIMEOUT=60 \
BUNDLE_BUILD__SASSC=--disable-march-tune-native
RUN mkdir /app
WORKDIR /app
EXPOSE 3000
ENTRYPOINT [ "/app/docker-entrypoint.sh"]
CMD ["-m", "--frontend" ]
ARG SHA
RUN echo "sha-${SHA}" > /etc/school-experience-sha
# remove upgrade zlib-dev & busybox when ruby:3.1.0-alpine3.15 base image is updated to address snyk vuln https://snyk.io/vuln/SNYK-ALPINE315-ZLIB-2434420
# also https://security.snyk.io/vuln/SNYK-ALPINE315-NCURSES-2952568
# hadolint ignore=DL3018
RUN apk update && apk add -Uu --no-cache zlib-dev busybox ncurses
# hadolint ignore=DL3018
RUN apk add -U --no-cache bash build-base git tzdata libxml2 libxml2-dev gcompat \
postgresql-libs postgresql-dev nodejs yarn \
chromium chromium-chromedriver
# Copy Entrypoint script
COPY script/docker-entrypoint.sh .
RUN chmod +x /app/docker-entrypoint.sh
# install NPM packages removign artifacts
COPY package.json yarn.lock ./
RUN yarn install && yarn cache clean
# Install Gems removing artifacts
COPY .ruby-version Gemfile Gemfile.lock ./
# hadolint ignore=SC2046
RUN gem install bundler --version='~> 2.5.11' && \
bundle install --jobs=$(nproc --all) && \
rm -rf /root/.bundle/cache && \
rm -rf /usr/local/bundle/cache
# Add code and compile assets
COPY . .
RUN bundle exec rake assets:precompile SECRET_KEY_BASE=stubbed SKIP_REDIS=true
# Create symlinks for CSS files without digest hashes for use in error pages
RUN bundle exec rake assets:symlink_non_digested SECRET_KEY_BASE=stubbed SKIP_REDIS=true