diff options
author | VirtualTam <virtualtam+github@flibidi.net> | 2018-02-24 13:36:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-24 13:36:55 +0100 |
commit | ddd3c19f4336495bbc8927fd552db0c4d9fe6662 (patch) | |
tree | 95ba7aac3025ca304837f1196324ab51206aeb04 /docker/alpine/Dockerfile.latest | |
parent | bc4a0a672ca2c653b79b5ada1713aa1a128bf62a (diff) | |
parent | 3c51135f9a2029989ec74809ce531fa4aa521fa7 (diff) | |
download | Shaarli-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)
Diffstat (limited to 'docker/alpine/Dockerfile.latest')
-rw-r--r-- | docker/alpine/Dockerfile.latest | 26 |
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 | ||
4 | FROM composer:latest as composer | ||
5 | RUN 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 | ||
1 | FROM alpine:3.6 | 12 | FROM alpine:3.6 |
2 | MAINTAINER Shaarli Community | 13 | LABEL maintainer="Shaarli Community" |
3 | 14 | ||
4 | RUN apk --update --no-cache add \ | 15 | RUN 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 | |||
25 | COPY php-fpm.conf /etc/php7/php-fpm.conf | 34 | COPY php-fpm.conf /etc/php7/php-fpm.conf |
26 | COPY services.d /etc/services.d | 35 | COPY services.d /etc/services.d |
27 | 36 | ||
28 | RUN curl -sS https://getcomposer.org/installer | php7 -- --install-dir=/usr/local/bin --filename=composer \ | 37 | RUN 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 | ||
34 | WORKDIR /var/www | 42 | WORKDIR /var/www |
35 | RUN curl -L https://github.com/shaarli/Shaarli/archive/latest.tar.gz | tar xzf - \ | 43 | COPY --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 | ||
42 | VOLUME /var/www/shaarli/data | 45 | VOLUME /var/www/shaarli/data |
43 | |||
44 | EXPOSE 80 | 46 | EXPOSE 80 |
45 | 47 | ||
46 | ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] | 48 | ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] |