aboutsummaryrefslogtreecommitdiffhomepage
path: root/docker/alpine/Dockerfile.latest
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2018-02-14 23:13:05 +0100
committerVirtualTam <virtualtam@flibidi.net>2018-02-14 23:13:05 +0100
commit3c51135f9a2029989ec74809ce531fa4aa521fa7 (patch)
tree0ab4e7c8d777f81bde62ee5389ecfe42dc24f220 /docker/alpine/Dockerfile.latest
parent8b48e36594394e367cbb33c7ad1a679ea57c374d (diff)
downloadShaarli-3c51135f9a2029989ec74809ce531fa4aa521fa7.tar.gz
Shaarli-3c51135f9a2029989ec74809ce531fa4aa521fa7.tar.zst
Shaarli-3c51135f9a2029989ec74809ce531fa4aa521fa7.zip
docker: introduce multi-stage image build (master, latest)
Relates to https://github.com/shaarli/Shaarli/issues/755 Relates to https://github.com/shaarli/Shaarli/pull/1072 See: - https://docs.docker.com/develop/develop-images/multistage-build/ - https://hub.docker.com/r/library/composer/ - https://github.com/composer/docker - https://github.com/docker-library/docs/tree/master/composer Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'docker/alpine/Dockerfile.latest')
-rw-r--r--docker/alpine/Dockerfile.latest26
1 files changed, 14 insertions, 12 deletions
diff --git a/docker/alpine/Dockerfile.latest b/docker/alpine/Dockerfile.latest
index dd4a173c..e9015c13 100644
--- a/docker/alpine/Dockerfile.latest
+++ b/docker/alpine/Dockerfile.latest
@@ -1,9 +1,19 @@
1# Stage 1:
2# - Get Shaarli sources
3# - Resolve PHP dependencies with Composer
4FROM composer:latest as composer
5RUN curl -L https://github.com/shaarli/Shaarli/archive/latest.tar.gz | tar xzf - \
6 && mv Shaarli-latest shaarli \
7 && cd shaarli \
8 && composer --prefer-dist --no-dev install
9
10# Stage 2:
11# - Shaarli image
1FROM alpine:3.6 12FROM alpine:3.6
2MAINTAINER Shaarli Community 13LABEL maintainer="Shaarli Community"
3 14
4RUN apk --update --no-cache add \ 15RUN apk --update --no-cache add \
5 ca-certificates \ 16 ca-certificates \
6 curl \
7 nginx \ 17 nginx \
8 php7 \ 18 php7 \
9 php7-ctype \ 19 php7-ctype \
@@ -15,7 +25,6 @@ RUN apk --update --no-cache add \
15 php7-json \ 25 php7-json \
16 php7-mbstring \ 26 php7-mbstring \
17 php7-openssl \ 27 php7-openssl \
18 php7-phar \
19 php7-session \ 28 php7-session \
20 php7-xml \ 29 php7-xml \
21 php7-zlib \ 30 php7-zlib \
@@ -25,22 +34,15 @@ COPY nginx.conf /etc/nginx/nginx.conf
25COPY php-fpm.conf /etc/php7/php-fpm.conf 34COPY php-fpm.conf /etc/php7/php-fpm.conf
26COPY services.d /etc/services.d 35COPY services.d /etc/services.d
27 36
28RUN curl -sS https://getcomposer.org/installer | php7 -- --install-dir=/usr/local/bin --filename=composer \ 37RUN rm -rf /etc/php7/php-fpm.d/www.conf \
29 && rm -rf /etc/php7/php-fpm.d/www.conf \
30 && sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php7/php.ini \ 38 && sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php7/php.ini \
31 && sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php7/php.ini 39 && sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php7/php.ini
32 40
33 41
34WORKDIR /var/www 42WORKDIR /var/www
35RUN curl -L https://github.com/shaarli/Shaarli/archive/latest.tar.gz | tar xzf - \ 43COPY --from=composer /app/shaarli shaarli
36 && mv Shaarli-latest shaarli \
37 && cd shaarli \
38 && composer --prefer-dist --no-dev install \
39 && rm -rf ~/.composer \
40 && chown -R nginx:nginx .
41 44
42VOLUME /var/www/shaarli/data 45VOLUME /var/www/shaarli/data
43
44EXPOSE 80 46EXPOSE 80
45 47
46ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] 48ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"]