]>
Commit | Line | Data |
---|---|---|
3c51135f | 1 | # Stage 1: |
2a3fe990 V |
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 \ | |
c909f5d5 | 7 | && apk add --no-cache gcc musl-dev \ |
2a3fe990 | 8 | && pip install --no-cache-dir mkdocs \ |
fd2e8fad | 9 | && mkdocs build --clean |
2a3fe990 V |
10 | |
11 | # Stage 2: | |
3c51135f V |
12 | # - Resolve PHP dependencies with Composer |
13 | FROM composer:latest as composer | |
2a3fe990 V |
14 | COPY --from=docs /usr/src/app/shaarli /app/shaarli |
15 | RUN cd shaarli \ | |
3c51135f V |
16 | && composer --prefer-dist --no-dev install |
17 | ||
2a3fe990 | 18 | # Stage 3: |
94abe0a6 | 19 | # - Frontend dependencies |
67d4029f | 20 | FROM node:12-alpine as node |
94abe0a6 A |
21 | COPY --from=composer /app/shaarli shaarli |
22 | RUN cd shaarli \ | |
23 | && yarn install \ | |
24 | && yarn run build \ | |
25 | && rm -rf node_modules | |
26 | ||
2a3fe990 | 27 | # Stage 4: |
3c51135f | 28 | # - Shaarli image |
495545f2 | 29 | FROM alpine:3.12 |
3c51135f | 30 | LABEL maintainer="Shaarli Community" |
1a216fae V |
31 | |
32 | RUN apk --update --no-cache add \ | |
33 | ca-certificates \ | |
1a216fae V |
34 | nginx \ |
35 | php7 \ | |
36 | php7-ctype \ | |
37 | php7-curl \ | |
38 | php7-fpm \ | |
39 | php7-gd \ | |
40 | php7-iconv \ | |
41 | php7-intl \ | |
42 | php7-json \ | |
43 | php7-mbstring \ | |
44 | php7-openssl \ | |
1a216fae V |
45 | php7-session \ |
46 | php7-xml \ | |
ff968606 | 47 | php7-simplexml \ |
1a216fae | 48 | php7-zlib \ |
2a20e67f | 49 | s6 |
1a216fae | 50 | |
2a3fe990 V |
51 | COPY .docker/nginx.conf /etc/nginx/nginx.conf |
52 | COPY .docker/php-fpm.conf /etc/php7/php-fpm.conf | |
53 | COPY .docker/services.d /etc/services.d | |
1a216fae | 54 | |
3c51135f | 55 | RUN rm -rf /etc/php7/php-fpm.d/www.conf \ |
1a216fae V |
56 | && sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php7/php.ini \ |
57 | && sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php7/php.ini | |
58 | ||
59 | ||
60 | WORKDIR /var/www | |
94abe0a6 | 61 | COPY --from=node /shaarli shaarli |
1a216fae | 62 | |
017baf57 A |
63 | RUN chown -R nginx:nginx . \ |
64 | && ln -sf /dev/stdout /var/log/nginx/shaarli.access.log \ | |
65 | && ln -sf /dev/stderr /var/log/nginx/shaarli.error.log | |
66 | ||
186d9eaa | 67 | VOLUME /var/www/shaarli/cache |
1a216fae V |
68 | VOLUME /var/www/shaarli/data |
69 | ||
70 | EXPOSE 80 | |
71 | ||
72 | ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] | |
73 | CMD [] |