-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (40 loc) · 1.47 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
FROM ruby:3.3.5-alpine3.20
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 tzdata 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 . .
# 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"]