forked from ngosang/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce Docker image size. resolves wallabag#269
Size (uncompressed): Previous 573.1 MB / This PR 225.8 MB Container startup time is faster. Ansible and chown where slow Build time is 3 times faster. Less packages and TAR download No changes required by the user. Same env vars, same paths, same core packages ... * Update Alpine 3.14. gnu-libiconv is already fixed in this version * Remove heavy packages: ansible, git, make, bash ... * Download Wallabag TAR. Is faster and git is not required * Replace environment variables with envsubst * Reorder steps to build faster and reduce image size
- Loading branch information
Showing
6 changed files
with
95 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
FROM alpine:3.12 | ||
FROM alpine:3.14 | ||
|
||
LABEL maintainer "Marvin Steadfast <[email protected]>" | ||
|
||
ARG WALLABAG_VERSION=2.4.2 | ||
|
||
RUN apk add gnu-libiconv --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ --allow-untrusted | ||
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php | ||
|
||
# Install dependencies | ||
RUN set -ex \ | ||
&& apk update \ | ||
&& apk upgrade --available \ | ||
&& apk add \ | ||
ansible \ | ||
curl \ | ||
git \ | ||
libwebp \ | ||
mariadb-client \ | ||
nginx \ | ||
pcre \ | ||
php7 \ | ||
|
@@ -49,24 +43,38 @@ RUN set -ex \ | |
py-simplejson \ | ||
rabbitmq-c \ | ||
s6 \ | ||
tar \ | ||
tzdata \ | ||
make \ | ||
bash \ | ||
# make \ | ||
# bash \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& ln -sf /dev/stdout /var/log/nginx/access.log \ | ||
&& ln -sf /dev/stderr /var/log/nginx/error.log \ | ||
&& ln -sf /dev/stderr /var/log/nginx/error.log | ||
|
||
# Install composer | ||
RUN set -ex \ | ||
&& curl -s https://getcomposer.org/installer | php \ | ||
&& mv composer.phar /usr/local/bin/composer \ | ||
&& composer selfupdate --1 \ | ||
&& git clone --branch $WALLABAG_VERSION --depth 1 https://github.com/wallabag/wallabag.git /var/www/wallabag | ||
&& mv composer.phar /usr/local/bin/composer | ||
|
||
# Install envsubst | ||
RUN set -ex \ | ||
&& curl -L -o /usr/local/bin/envsubst https://github.com/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m` \ | ||
&& chmod +x /usr/local/bin/envsubst | ||
|
||
# Download Wallabag | ||
RUN set -ex \ | ||
&& curl -L -o /tmp/wallabag.tar.gz https://github.com/wallabag/wallabag/archive/$WALLABAG_VERSION.tar.gz \ | ||
&& tar xvf /tmp/wallabag.tar.gz -C /tmp \ | ||
&& mv /tmp/wallabag-*/ /var/www/wallabag \ | ||
&& rm -rf /tmp/wallabag* | ||
|
||
# Copy resources | ||
COPY root / | ||
|
||
# Install Wallabag | ||
RUN set -ex \ | ||
&& cd /var/www/wallabag \ | ||
&& SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist --no-progress \ | ||
&& chown -R nobody:nobody /var/www/wallabag | ||
&& rm -rf /root/.composer/* /var/www/wallabag/var/cache/* /var/www/wallabag/var/logs/* /var/www/wallabag/var/sessions/* | ||
|
||
EXPOSE 80 | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.