-
Notifications
You must be signed in to change notification settings - Fork 3
/
2.3-alpine.dockerfile
48 lines (44 loc) · 1.75 KB
/
2.3-alpine.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
FROM ruby:2.3-alpine
MAINTAINER [email protected]
# Set all environment variables at once
ENV GOSU_VERSION=1.10 \
GEM_HOME=/home/app/bundle \
BUNDLE_PATH=/home/app/bundle \
BUNDLE_APP_CONFIG=/home/app/bundle \
APP=/home/app/webapp \
PATH=/home/app/webapp/bin:/home/app/bundle/bin:$PATH \
DB_ADAPTER=sqlite3
# Install bash, less, nodejs, db clients and gosu
# Create app directory and set permissions
# Remove cache
RUN apk add --no-cache \
bash less nodejs \
build-base ruby-dev \
libc-dev libffi-dev \
sqlite-dev postgresql-dev mysql-dev \
libxml2-dev libxslt-dev \
tzdata \
dpkg gnupg openssl \
&& dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true \
&& addgroup -g 1000 app \
&& adduser -u 1000 -D -G app -s /bin/bash app \
&& mkdir -p "$APP" "$GEM_HOME/bin" \
&& { \
echo 'install: --no-document'; \
echo 'update: --no-document'; \
} >> /home/app/.gemrc \
&& chown -R app:app /home/app \
&& find / -type f -iname '*.apk-new' -delete \
&& rm -rf '/var/cache/apk/*' '/tmp/*' '/var/tmp/*'
WORKDIR $APP
COPY start.sh template.rb entrypoint.sh install_rails.sh /home/app/
ENTRYPOINT ["/home/app/entrypoint.sh"]
CMD ["/home/app/start.sh"]