This repository has been archived by the owner on Aug 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (53 loc) · 1.59 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
FROM ruby:2.6.5
MAINTAINER dxw <[email protected]>
# install base packages
RUN apt-get update -y -q2 \
&& apt-get upgrade -y -q2 \
&& apt-get -y -q2 install \
nodejs \
&& apt-get -y -q2 clean
# create application user
RUN addgroup --gid 999 --quiet app \
&& adduser --gid 999 --uid 999 --quiet --disabled-password app
# set rails environment
ARG RAILS_ENV
ENV RAILS_ENV=${RAILS_ENV:-production}
ENV RACK_ENV=${RAILS_ENV:-production}
# create and use application home
ENV APP_NAME team-dashboard
ENV APP_PATH /srv/team-dashboard
COPY docker-entrypoint.sh .
RUN mkdir -p $APP_PATH
WORKDIR $APP_PATH
# bundle ruby gems to create a static dependency tree
USER app
ENV GEM_PATH /usr/local/bundle
RUN gem install --quiet bundler
USER root
COPY Gemfile $APP_PATH/Gemfile
COPY Gemfile.lock $APP_PATH/Gemfile.lock
RUN chown -R app:app $APP_PATH
ARG GITHUB_TOKEN
ARG BUNDLE_GITHUB__COM=${GITHUB_TOKEN}:x-oauth-basic
USER app
# bundle ruby gems based on the current environment, default to production
RUN \
if [ "$RAILS_ENV" = "production" ]; then \
bundle install --without development test --jobs 25 --retry 3; \
else \
bundle install --jobs 25 --retry 3; \
fi
USER root
# add project files
COPY . $APP_PATH
# compile assets for production
RUN SECRET_KEY_BASE=dummy bundle exec rake assets:precompile
RUN mkdir -p tmp/pids
# make app own the project files
RUN chown -R app:app $APP_PATH
# run application as the app user
USER app
# expose public assets as a volume, this needs to happen after any changes to the filesystem
VOLUME ["/srv/team-dashboard/public"]
EXPOSE 3000
CMD ["bundle", "exec", "puma"]