avoiding curl by using busybox' wget, deduplication of commands

master
El RIDO 4 years ago
parent 5b6a042eb9
commit fd564b47e1
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92

@ -10,54 +10,51 @@ ENV S6_READ_ONLY_ROOT 1
RUN \
# Install dependencies
apk add --no-cache tzdata nginx php7-fpm php7-json php7-gd \
php7-opcache php7-pdo_mysql php7-pdo_pgsql \
apk add --no-cache gnupg libcap nginx php7-fpm php7-json php7-gd \
php7-opcache php7-pdo_mysql php7-pdo_pgsql tzdata \
# Remove (some of the) default nginx config
&& rm -f /etc/nginx.conf /etc/nginx/conf.d/default.conf /etc/php7/php-fpm.d/www.conf \
&& rm -rf /etc/nginx/sites-* \
# Ensure nginx logs, even if the config has errors, are written to stderr
&& ln -s /dev/stderr /var/log/nginx/error.log \
# Install PrivateBin
&& apk add --no-cache gnupg curl libcap \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg2 --list-public-keys || /bin/true \
&& curl -s https://privatebin.info/key/release.asc | gpg2 --import - \
&& wget -qO - https://privatebin.info/key/release.asc | gpg2 --import - \
&& rm -rf /var/www/* \
&& cd /tmp \
&& curl -Ls ${PBURL}releases/download/${RELEASE}/PrivateBin-${RELEASE}.tar.gz.asc > PrivateBin-${RELEASE}.tar.gz.asc \
&& curl -Ls ${PBURL}archive/${RELEASE}.tar.gz > PrivateBin-${RELEASE}.tar.gz \
&& gpg2 --verify PrivateBin-${RELEASE}.tar.gz.asc \
&& wget -qO ${RELEASE}.tar.gz.asc ${PBURL}releases/download/${RELEASE}/PrivateBin-${RELEASE}.tar.gz.asc \
&& wget -q ${PBURL}archive/${RELEASE}.tar.gz \
&& gpg2 --verify ${RELEASE}.tar.gz.asc \
&& cd /var/www \
&& tar -xzf /tmp/PrivateBin-${RELEASE}.tar.gz --strip 1 \
&& tar -xzf /tmp/${RELEASE}.tar.gz --strip 1 \
&& rm *.md cfg/conf.sample.php \
&& mv cfg /srv \
&& mv lib /srv \
&& mv tpl /srv \
&& mv vendor /srv \
&& mv cfg lib tpl vendor /srv \
&& mkdir -p /srv/data \
&& sed -i "s#define('PATH', '');#define('PATH', '/srv/');#" index.php \
# Install s6 overlay for service management
&& curl -s https://keybase.io/justcontainers/key.asc | gpg2 --import - \
&& wget -qO - https://keybase.io/justcontainers/key.asc | gpg2 --import - \
&& cd /tmp \
&& S6ARCH=$(uname -m) \
&& case ${S6ARCH} in \
x86_64) S6ARCH=amd64;; \
armv7l) S6ARCH=armhf;; \
esac \
&& curl -Ls ${S6URL}${S6RELEASE}/s6-overlay-${S6ARCH}.tar.gz.sig > s6-overlay-${S6ARCH}.tar.gz.sig \
&& curl -Ls ${S6URL}${S6RELEASE}/s6-overlay-${S6ARCH}.tar.gz > s6-overlay-${S6ARCH}.tar.gz \
&& wget -q ${S6URL}${S6RELEASE}/s6-overlay-${S6ARCH}.tar.gz.sig \
&& wget -q ${S6URL}${S6RELEASE}/s6-overlay-${S6ARCH}.tar.gz \
&& gpg2 --verify s6-overlay-${S6ARCH}.tar.gz.sig \
&& tar -xzf s6-overlay-${S6ARCH}.tar.gz -C / \
# Support running s6 under a non-root user
&& mkdir -p /etc/services.d/nginx/supervise /etc/services.d/php-fpm7/supervise \
&& mkfifo /etc/services.d/nginx/supervise/control \
&& mkfifo /etc/services.d/php-fpm7/supervise/control \
&& mkfifo /etc/s6/services/s6-fdholderd/supervise/control \
&& mkfifo \
/etc/services.d/nginx/supervise/control \
/etc/services.d/php-fpm7/supervise/control \
/etc/s6/services/s6-fdholderd/supervise/control \
&& setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \
&& chown -R nobody.www-data /var/lib/nginx /var/tmp/nginx /var/www /srv/* /etc/services.d /etc/s6 /run \
# Clean up
&& rm -rf "${GNUPGHOME}" /tmp/* \
&& apk del gnupg curl libcap
&& apk del gnupg libcap
COPY etc/ /etc/

Loading…
Cancel
Save