diff options
author | VirtualTam <virtualtam@flibidi.net> | 2018-06-17 01:02:50 +0200 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2018-06-17 01:02:50 +0200 |
commit | 2a3fe990dd0730fce9465bbef6ad1a01054f775d (patch) | |
tree | 4abc8afd3bd63145e66f77f9279de7b246ceb7bd /Dockerfile | |
parent | 7cf436cea4d05fe667c479be8b909c55c3f1da40 (diff) | |
download | Shaarli-2a3fe990dd0730fce9465bbef6ad1a01054f775d.tar.gz Shaarli-2a3fe990dd0730fce9465bbef6ad1a01054f775d.tar.zst Shaarli-2a3fe990dd0730fce9465bbef6ad1a01054f775d.zip |
docker: build the images from the local sources
Relates to https://github.com/shaarli/Shaarli/issues/1153
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..4cda6f31 --- /dev/null +++ b/Dockerfile | |||
@@ -0,0 +1,70 @@ | |||
1 | # Stage 1: | ||
2 | # - Copy Shaarli sources | ||
3 | # - Build documentation | ||
4 | FROM python:3-alpine as docs | ||
5 | ADD . /usr/src/app/shaarli | ||
6 | RUN cd /usr/src/app/shaarli \ | ||
7 | && pip install --no-cache-dir mkdocs \ | ||
8 | && mkdocs build | ||
9 | |||
10 | # Stage 2: | ||
11 | # - Resolve PHP dependencies with Composer | ||
12 | FROM composer:latest as composer | ||
13 | COPY --from=docs /usr/src/app/shaarli /app/shaarli | ||
14 | RUN cd shaarli \ | ||
15 | && composer --prefer-dist --no-dev install | ||
16 | |||
17 | # Stage 3: | ||
18 | # - Frontend dependencies | ||
19 | FROM node:9.9-alpine as node | ||
20 | COPY --from=composer /app/shaarli shaarli | ||
21 | RUN cd shaarli \ | ||
22 | && yarn install \ | ||
23 | && yarn run build \ | ||
24 | && rm -rf node_modules | ||
25 | |||
26 | # Stage 4: | ||
27 | # - Shaarli image | ||
28 | FROM alpine:3.6 | ||
29 | LABEL maintainer="Shaarli Community" | ||
30 | |||
31 | RUN apk --update --no-cache add \ | ||
32 | ca-certificates \ | ||
33 | nginx \ | ||
34 | php7 \ | ||
35 | php7-ctype \ | ||
36 | php7-curl \ | ||
37 | php7-fpm \ | ||
38 | php7-gd \ | ||
39 | php7-iconv \ | ||
40 | php7-intl \ | ||
41 | php7-json \ | ||
42 | php7-mbstring \ | ||
43 | php7-openssl \ | ||
44 | php7-session \ | ||
45 | php7-xml \ | ||
46 | php7-zlib \ | ||
47 | s6 | ||
48 | |||
49 | COPY .docker/nginx.conf /etc/nginx/nginx.conf | ||
50 | COPY .docker/php-fpm.conf /etc/php7/php-fpm.conf | ||
51 | COPY .docker/services.d /etc/services.d | ||
52 | |||
53 | RUN rm -rf /etc/php7/php-fpm.d/www.conf \ | ||
54 | && sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php7/php.ini \ | ||
55 | && sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php7/php.ini | ||
56 | |||
57 | |||
58 | WORKDIR /var/www | ||
59 | COPY --from=node /shaarli shaarli | ||
60 | |||
61 | RUN chown -R nginx:nginx . \ | ||
62 | && ln -sf /dev/stdout /var/log/nginx/shaarli.access.log \ | ||
63 | && ln -sf /dev/stderr /var/log/nginx/shaarli.error.log | ||
64 | |||
65 | VOLUME /var/www/shaarli/data | ||
66 | |||
67 | EXPOSE 80 | ||
68 | |||
69 | ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] | ||
70 | CMD [] | ||