forked from errbit/errbit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
56 lines (42 loc) · 1.4 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
FROM ruby:2.3.3-alpine
LABEL maintainer="David Papp <[email protected]>"
ARG UID=101
ARG GID=101
RUN addgroup -g $GID -S errbit \
&& adduser -u $UID -S -D -s /bin/false -G errbit -g errbit errbit
# throw errors if Gemfile has been modified since Gemfile.lock
RUN echo "gem: --no-document" >> /etc/gemrc \
&& bundle config --global frozen 1 \
&& bundle config --global clean true \
&& bundle config --global disable_shared_gems false
RUN mkdir -p /app \
&& chown -R errbit:errbit /app \
&& chmod 705 /app/
WORKDIR /app
RUN gem update --system 2.7.4 \
&& gem install bundler --version 1.16.1 \
&& apk add --no-cache \
curl \
less \
libxml2-dev \
libxslt-dev \
nodejs \
tzdata
EXPOSE 8080
COPY ["Gemfile", "Gemfile.lock", "/app/"]
RUN apk add --no-cache --virtual build-dependencies \
build-base \
&& bundle config build.nokogiri --use-system-libraries \
&& bundle install \
-j "$(getconf _NPROCESSORS_ONLN)" \
--retry 5 \
--without test development no_docker \
&& apk del build-dependencies
COPY . /app
RUN RAILS_ENV=production bundle exec rake assets:precompile
RUN chown -R errbit:errbit /app
COPY bin/docker-entrypoint.sh /usr/local/bin/
USER errbit
HEALTHCHECK CMD curl --fail "http://$(/bin/hostname -i | /usr/bin/awk '{ print $1 }'):8080/users/sign_in" || exit 1
CMD ["puma","-C","config/puma.default.rb"]
ENTRYPOINT ["docker-entrypoint.sh"]