-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
75 lines (58 loc) · 1.81 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
FROM ruby:3.3.5-alpine3.20
LABEL maintainer="LAA Crime Apply Team"
RUN apk --no-cache add --virtual build-deps \
build-base \
postgresql15-dev \
git \
bash \
curl \
&& apk --no-cache add \
postgresql15-client \
shared-mime-info \
linux-headers \
xz-libs \
tzdata \
yarn \
gcompat
# add non-root user and group with alpine first available uid, 1000
RUN addgroup -g 1000 -S appgroup && \
adduser -u 1000 -S appuser -G appgroup
# create some required directories
RUN mkdir -p /usr/src/app && \
mkdir -p /usr/src/app/log && \
mkdir -p /usr/src/app/tmp && \
mkdir -p /usr/src/app/tmp/pids
WORKDIR /usr/src/app
COPY Gemfile* .ruby-version ./
RUN gem install bundler && \
bundle config set frozen 'true' && \
bundle config without test:development && \
bundle install --jobs 2 --retry 3
COPY . .
RUN yarn install --pure-lockfile
RUN RAILS_ENV=production \
ENV_NAME=production \
SECRET_KEY_BASE=dummy_for_turbo_signed_stream_verifier_on_precompile \
GOVUK_NOTIFY_API_KEY=replace_this_at_build_time \
rails assets:precompile --trace
# tidy up installation
RUN apk del build-deps && rm -rf /tmp/*
# non-root/appuser should own only what they need to
RUN chown -R appuser:appgroup log tmp db
# Download RDS certificates bundle -- needed for SSL verification
# We set the path to the bundle in the ENV, and use it in `/config/database.yml`
#
ENV RDS_COMBINED_CA_BUNDLE /usr/src/app/config/global-bundle.pem
ADD https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem $RDS_COMBINED_CA_BUNDLE
RUN chmod +r $RDS_COMBINED_CA_BUNDLE
ARG APP_BUILD_DATE
ENV APP_BUILD_DATE ${APP_BUILD_DATE}
ARG APP_BUILD_TAG
ENV APP_BUILD_TAG ${APP_BUILD_TAG}
ARG APP_GIT_COMMIT
ENV APP_GIT_COMMIT ${APP_GIT_COMMIT}
ENV APPUID 1000
USER $APPUID
ENV PORT 3000
EXPOSE $PORT
ENTRYPOINT ["./run.sh"]