forked from octobox/octobox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
45 lines (36 loc) · 1.04 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
FROM ruby:2.6.1-alpine
ENV APP_ROOT /usr/src/app
WORKDIR $APP_ROOT
# =============================================
# System layer
# Will invalidate cache as soon as the Gemfile changes
COPY Gemfile Gemfile.lock $APP_ROOT/
# * Setup system
# * Install Ruby dependencies
RUN apk add --update \
build-base \
netcat-openbsd \
git \
nodejs \
postgresql-dev \
mysql-dev \
tzdata \
curl-dev \
&& rm -rf /var/cache/apk/* \
&& bundle config --global frozen 1 \
&& bundle install --without test --jobs 2 \
&& gem install foreman
# ========================================================
# Application layer
# Copy application code
COPY . $APP_ROOT
# Precompile assets for a production environment.
# This is done to include assets in production images on Dockerhub.
RUN RAILS_ENV=production bundle exec rake assets:precompile
# * Generate the docs
# * Make files OpenShift conformant
RUN RAILS_ENV=development bin/rails api_docs:generate \
&& chgrp -R 0 $APP_ROOT \
&& chmod -R g=u $APP_ROOT
# Startup
CMD ["bin/docker-start"]