aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVirtualTam <virtualtam+github@flibidi.net>2018-02-24 13:36:55 +0100
committerGitHub <noreply@github.com>2018-02-24 13:36:55 +0100
commitddd3c19f4336495bbc8927fd552db0c4d9fe6662 (patch)
tree95ba7aac3025ca304837f1196324ab51206aeb04
parentbc4a0a672ca2c653b79b5ada1713aa1a128bf62a (diff)
parent3c51135f9a2029989ec74809ce531fa4aa521fa7 (diff)
downloadShaarli-ddd3c19f4336495bbc8927fd552db0c4d9fe6662.tar.gz
Shaarli-ddd3c19f4336495bbc8927fd552db0c4d9fe6662.tar.zst
Shaarli-ddd3c19f4336495bbc8927fd552db0c4d9fe6662.zip
Merge pull request #1085 from virtualtam/docker/multi-stage
docker: introduce multi-stage image build (master, latest)
-rw-r--r--docker/alpine/Dockerfile.latest26
-rw-r--r--docker/alpine/Dockerfile.master26
2 files changed, 29 insertions, 23 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"]
diff --git a/docker/alpine/Dockerfile.master b/docker/alpine/Dockerfile.master
index 58f7c6e7..9cb4dec4 100644
--- a/docker/alpine/Dockerfile.master
+++ b/docker/alpine/Dockerfile.master
@@ -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/master.tar.gz | tar xzf - \
6 && mv Shaarli-master 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,20 +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/master.tar.gz | tar xzf - \ 43COPY --from=composer /app/shaarli shaarli
36 && mv Shaarli-master shaarli \
37 && cd shaarli \
38 && composer --prefer-dist --no-dev install \
39 && rm -rf ~/.composer \
40 && chown -R nginx:nginx .
41 44
45RUN chown -R nginx:nginx .
42VOLUME /var/www/shaarli/data 46VOLUME /var/www/shaarli/data
43 47
44EXPOSE 80 48EXPOSE 80