From 2a3fe990dd0730fce9465bbef6ad1a01054f775d Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sun, 17 Jun 2018 01:02:50 +0200 Subject: docker: build the images from the local sources Relates to https://github.com/shaarli/Shaarli/issues/1153 Signed-off-by: VirtualTam --- Dockerfile.armhf | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Dockerfile.armhf (limited to 'Dockerfile.armhf') diff --git a/Dockerfile.armhf b/Dockerfile.armhf new file mode 100644 index 00000000..5dcc34aa --- /dev/null +++ b/Dockerfile.armhf @@ -0,0 +1,49 @@ +FROM lsiobase/alpine.armhf:3.6 +LABEL maintainer="Shaarli Community" + +RUN apk --update --no-cache add \ + ca-certificates \ + curl \ + nginx \ + php7 \ + php7-ctype \ + php7-curl \ + php7-fpm \ + php7-gd \ + php7-iconv \ + php7-intl \ + php7-json \ + php7-mbstring \ + php7-openssl \ + php7-phar \ + php7-session \ + php7-xml \ + php7-zlib \ + s6 + +COPY .docker/nginx.conf /etc/nginx/nginx.conf +COPY .docker/php-fpm.conf /etc/php7/php-fpm.conf +COPY .docker/services.d /etc/services.d + +RUN curl -sS https://getcomposer.org/installer | php7 -- --install-dir=/usr/local/bin --filename=composer \ + && rm -rf /etc/php7/php-fpm.d/www.conf \ + && sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php7/php.ini \ + && sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php7/php.ini + + +WORKDIR /var/www +RUN curl -L https://github.com/shaarli/Shaarli/archive/master.tar.gz | tar xzf - \ + && mv Shaarli-master shaarli \ + && cd shaarli \ + && composer --prefer-dist --no-dev install \ + && rm -rf ~/.composer \ + && chown -R nginx:nginx . \ + && ln -sf /dev/stdout /var/log/nginx/shaarli.access.log \ + && ln -sf /dev/stderr /var/log/nginx/shaarli.error.log + +VOLUME /var/www/shaarli/data + +EXPOSE 80 + +ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] +CMD [] -- cgit v1.2.3 From e3af34d06dff82318d8c496caf12ccb70a01c118 Mon Sep 17 00:00:00 2001 From: Adrien le Maire Date: Wed, 25 Jul 2018 12:54:22 +0200 Subject: fix and simplify Dockerfile for armhf --- Dockerfile.armhf | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) (limited to 'Dockerfile.armhf') diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 5dcc34aa..1185e2df 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,9 +1,38 @@ -FROM lsiobase/alpine.armhf:3.6 +# Stage 1: +# - Copy Shaarli sources +# - Build documentation +FROM arm32v6/alpine:3.8 as docs +ADD . /usr/src/app/shaarli +RUN apk --update --no-cache add py2-pip \ + && cd /usr/src/app/shaarli \ + && pip install --no-cache-dir mkdocs \ + && mkdocs build --clean + +# Stage 2: +# - Resolve PHP dependencies with Composer +FROM arm32v6/alpine:3.8 as composer +COPY --from=docs /usr/src/app/shaarli /app/shaarli +RUN apk --update --no-cache add php7-mbstring composer \ + && cd /app/shaarli \ + && composer --prefer-dist --no-dev install + +# Stage 3: +# - Frontend dependencies +FROM arm32v6/alpine:3.8 as node +COPY --from=composer /app/shaarli /shaarli +RUN apk --update --no-cache add yarn nodejs-current python2 build-base \ + && cd /shaarli \ + && yarn install \ + && yarn run build \ + && rm -rf node_modules + +# Stage 4: +# - Shaarli image +FROM arm32v6/alpine:3.8 LABEL maintainer="Shaarli Community" RUN apk --update --no-cache add \ ca-certificates \ - curl \ nginx \ php7 \ php7-ctype \ @@ -15,7 +44,6 @@ RUN apk --update --no-cache add \ php7-json \ php7-mbstring \ php7-openssl \ - php7-phar \ php7-session \ php7-xml \ php7-zlib \ @@ -25,22 +53,19 @@ COPY .docker/nginx.conf /etc/nginx/nginx.conf COPY .docker/php-fpm.conf /etc/php7/php-fpm.conf COPY .docker/services.d /etc/services.d -RUN curl -sS https://getcomposer.org/installer | php7 -- --install-dir=/usr/local/bin --filename=composer \ - && rm -rf /etc/php7/php-fpm.d/www.conf \ +RUN rm -rf /etc/php7/php-fpm.d/www.conf \ && sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php7/php.ini \ && sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php7/php.ini WORKDIR /var/www -RUN curl -L https://github.com/shaarli/Shaarli/archive/master.tar.gz | tar xzf - \ - && mv Shaarli-master shaarli \ - && cd shaarli \ - && composer --prefer-dist --no-dev install \ - && rm -rf ~/.composer \ - && chown -R nginx:nginx . \ +COPY --from=node /shaarli /var/www/shaarli + +RUN chown -R nginx:nginx . \ && ln -sf /dev/stdout /var/log/nginx/shaarli.access.log \ && ln -sf /dev/stderr /var/log/nginx/shaarli.error.log +VOLUME /var/www/shaarli/cache VOLUME /var/www/shaarli/data EXPOSE 80 -- cgit v1.2.3