-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
55 lines (42 loc) · 1.52 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
FROM ruby:3.3
#Set up variables for creating a user to run the app in the container
ARG UID
ARG GID
ARG UNAME=app
ENV APP_HOME /app
ENV BUNDLE_PATH /bundle
#Create the group for the user
RUN if [ x"${GID}" != x"" ] ; \
then groupadd ${UNAME} -g ${GID} -o ; \
else groupadd ${UNAME} ; \
fi
#Create the User and assign ${APP_HOME} as its home directory
RUN if [ x"${UID}" != x"" ] ; \
then useradd -m -d ${APP_HOME} -u ${UID} -o -g ${UNAME} -s /bin/bash ${UNAME} ; \
else useradd -m -d ${APP_HOME} -g ${UNAME} -s /bin/bash ${UNAME} ; \
fi
WORKDIR $APP_HOME
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install -y nodejs
RUN mkdir -p ${BUNDLE_PATH} ${APP_HOME}/public ${APP_HOME}/tmp && chown -R ${UNAME} ${BUNDLE_PATH} ${APP_HOME}/public ${APP_HOME}/tmp
USER $UNAME
COPY --chown=${UNAME}:${UNAME} Gemfile* ${APP_HOME}/
COPY --chown=${UNAME}:${UNAME} local-gems/ ${APP_HOME}/local-gems/
RUN bundle install
COPY . ${APP_HOME}
ARG SEARCH_VERSION=master
ARG PRIDE_VERSION=master
ARG BASE_URL=http://localhost:3000
ARG BIND_IP=0.0.0.0
ARG BIND_PORT=3000
ARG RAILS_ENV=production
ENV RAILS_RELATIVE_URL_ROOT=${BASE_URL}/spectrum \
RAILS_ENV=${RAILS_ENV} \
SPECTRUM_INST_LOCATION_FILES_DIR=config \
SPECTRUM_SEARCH_GIT_BRANCH=${SEARCH_VERSION} \
SPECTRUM_PRIDE_GIT_BRANCH=${PRIDE_VERSION} \
REACT_APP_LOGIN_BASE_URL=${BASE_URL} \
REACT_APP_SPECTRUM_BASE_URL=${BASE_URL}/spectrum \
BIND_IP=${BIND_IP} \
BIND_PORT=${BIND_PORT}
CMD bundle exec puma -c config/puma.rb