forked from ukparliament/styleguide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·41 lines (29 loc) · 946 Bytes
/
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
FROM ruby:2.3.1
ENV APP_USER parliament
# create user to run app in user space
RUN set -x \
&& groupadd -g 5000 $APP_USER \
&& adduser --disabled-password --uid 5000 --gid 5000 --gecos '' $APP_USER
ENV RAILS_ROOT /opt/styleguide
RUN mkdir -p $RAILS_ROOT
# add project
COPY . $RAILS_ROOT
RUN chown -R $APP_USER:$APP_USER $RAILS_ROOT
# git submodule
RUN cd $RAILS_ROOT && git submodule init
RUN cd $RAILS_ROOT && git submodule update --remote
# cache the gems
COPY Gemfile $RAILS_ROOT/Gemfile
COPY Gemfile.lock $RAILS_ROOT/Gemfile.lock
RUN cd $RAILS_ROOT && env NOKOGIRI_USE_SYSTEM_LIBRARIES=true bundle install \
&& chown -R $APP_USER:$APP_USER $GEM_HOME
# nodejs
RUN cd $RAILS_ROOT && apt-get update && apt-get install -y nodejs && apt-get install -y npm
USER $USER
WORKDIR $RAILS_ROOT
ARG GIT_SHA=unknown
ARG GIT_TAG=unknown
LABEL git-sha=$GIT_SHA \
git-tag=$GIT_TAG
# EXPOSE 3000
CMD ["passenger", "start"]