-
Notifications
You must be signed in to change notification settings - Fork 38
/
Dockerfile
72 lines (62 loc) · 2.08 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
FROM ruby:2.7
LABEL maintainer="Max Burnette <[email protected]>, Rob Kooper <[email protected]>"
# arguments that are added at the bottom of BETY
ARG BETY_GIT_TAGS="unknown"
ARG BETY_GIT_BRANCH="unknown"
ARG BETY_GIT_CHECKSUM="unknown"
ARG BETY_GIT_DATE="unknown"
# environment variables used
ENV LOCAL_SERVER=99 \
REMOTE_SERVERS="0 1 2 5" \
INITIALIZE_FLAGS="-g -u" \
INITIALIZE_URL="-w https://ebi-forecast.igb.illinois.edu/pecan/dump/all/bety.tar.gz" \
RAILS_ENV="production" \
RAILS_RELATIVE_URL_ROOT="" \
SECRET_KEY_BASE="thisisnotasecret" \
UNICORN_WORKER_PROCESSES="3" \
UNICORN_PORT="8000" \
BETY_GIT_TAGS=${BETY_GIT_TAGS} \
BETY_GIT_BRANCH=${BETY_GIT_BRANCH} \
BETY_GIT_CHECKSUM=${BETY_GIT_CHECKSUM} \
BETY_GIT_DATE=${BETY_GIT_DATE} \
PGHOST=postgres \
PGUSER=postgres \
PGDATABASE=postgres \
BETYUSER=bety \
BETYPASSWORD=bety \
BETYDATABASE=bety \
GOOGLE_ANALYTICS_ID=G-0000000000
# Install dependencies
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
curl \
git \
libgeos-dev \
netcat \
nodejs \
postgresql-client \
&& rm -rf /var/lib/apt/lists/* \
&& useradd -m -u 1000 -s /bin/bash bety
# change to working directory
USER bety
WORKDIR /home/bety
# install gems (allowing for caching)
COPY --chown=bety /Gemfile* /home/bety/
RUN gem install bundler -v 1.17.3 \
&& bundle config path vendor/bundle \
&& bundle config without 'test development production debug javascript_testing' \
&& bundle config with 'docker' \
&& bundle install --jobs 4 --retry 3
# copy rest of the files
COPY --chown=bety / /home/bety
COPY --chown=bety /docker/database.yml /home/bety/config/database.yml
COPY --chown=bety /docker/config.ru /home/bety/config.ru
# configure app
RUN /bin/sed -e '/serve_static_assets/ s/false$/true/' -i config/environments/production.rb
# expose public files
VOLUME ["/home/bety/log"]
# port that is exposed
EXPOSE 8000
# default command to run bety web-app
ENTRYPOINT ["/home/bety/docker/entrypoint.sh"]
CMD ["unicorn"]