be more OCI compliant, avoid unnecessary work
This commit is contained in:
parent
0a39c4075b
commit
09912939fe
1 changed files with 33 additions and 20 deletions
53
Dockerfile
53
Dockerfile
|
@ -1,21 +1,30 @@
|
|||
FROM alpine:3.14
|
||||
|
||||
MAINTAINER PrivateBin <support@privatebin.org>
|
||||
ARG ALPINE_PACKAGES="php8-pdo_mysql php8-pdo_pgsql php8-openssl"
|
||||
ARG COMPOSER_PACKAGES=google/cloud-storage
|
||||
ARG PBURL=https://github.com/PrivateBin/PrivateBin/
|
||||
ARG RELEASE=1.3.5
|
||||
|
||||
ARG ALPINE_PACKAGES="php8-pdo_mysql php8-pdo_pgsql"
|
||||
ARG COMPOSER_PACKAGES="google/cloud-storage"
|
||||
ENV CONFIG_PATH=/srv/cfg S6_READ_ONLY_ROOT=1
|
||||
|
||||
ENV RELEASE 1.3.5
|
||||
ENV PBURL https://github.com/PrivateBin/PrivateBin/
|
||||
ENV S6_READ_ONLY_ROOT 1
|
||||
ENV CONFIG_PATH /srv/cfg
|
||||
LABEL org.opencontainers.image.authors=support@privatebin.org \
|
||||
org.opencontainers.image.vendor=PrivateBin \
|
||||
org.opencontainers.image.documentation=https://github.com/PrivateBin/docker-nginx-fpm-alpine/blob/master/README.md \
|
||||
org.opencontainers.image.source=https://github.com/PrivateBin/docker-nginx-fpm-alpine \
|
||||
org.opencontainers.image.licenses=zlib-acknowledgement \
|
||||
org.opencontainers.image.version=${RELEASE}
|
||||
|
||||
RUN \
|
||||
# Prepare composer dependencies
|
||||
ALPINE_COMPOSER_PACKAGES="" ;\
|
||||
if [ -n "${COMPOSER_PACKAGES}" ] ; then \
|
||||
ALPINE_COMPOSER_PACKAGES="php8 php8-curl php8-mbstring php8-phar" ;\
|
||||
RAWURL="$(echo ${PBURL} | sed s/github.com/raw.githubusercontent.com/)" ;\
|
||||
fi \
|
||||
# Install dependencies
|
||||
apk add --no-cache gnupg nginx php8 php8-curl php8-fpm php8-json php8-gd \
|
||||
php8-mbstring php8-opcache php8-phar \
|
||||
s6-overlay tzdata php8-openssl $ALPINE_PACKAGES \
|
||||
&& apk upgrade --no-cache \
|
||||
&& apk add --no-cache gnupg nginx php8-fpm php8-json php8-gd php8-opcache \
|
||||
s6-overlay tzdata ${ALPINE_PACKAGES} ${ALPINE_COMPOSER_PACKAGES} \
|
||||
# Remove (some of the) default nginx config
|
||||
&& rm -f /etc/nginx.conf /etc/nginx/http.d/default.conf /etc/php8/php-fpm.d/www.conf \
|
||||
&& rm -rf /etc/nginx/sites-* \
|
||||
|
@ -27,19 +36,23 @@ RUN \
|
|||
&& wget -qO - https://privatebin.info/key/release.asc | gpg2 --import - \
|
||||
&& rm -rf /var/www/* \
|
||||
&& cd /tmp \
|
||||
&& wget -qO ${RELEASE}.tar.gz.asc ${PBURL}releases/download/${RELEASE}/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 \
|
||||
&& wget -qO composer-setup.php https://getcomposer.org/installer \
|
||||
&& ln -s $(which php8) /usr/local/bin/php \
|
||||
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
|
||||
&& if [ -n "${COMPOSER_PACKAGES}" ] ; then \
|
||||
wget -qO composer-installer.php https://getcomposer.org/installer \
|
||||
&& ln -s $(which php8) /usr/local/bin/php \
|
||||
&& php composer-installer.php --install-dir=/usr/local/bin --filename=composer ;\
|
||||
fi \
|
||||
&& cd /var/www \
|
||||
&& tar -xzf /tmp/${RELEASE}.tar.gz --strip 1 \
|
||||
&& wget -q $(echo ${PBURL} | sed s/github.com/raw.githubusercontent.com/)${RELEASE}/composer.json \
|
||||
&& wget -q $(echo ${PBURL} | sed s/github.com/raw.githubusercontent.com/)${RELEASE}/composer.lock \
|
||||
&& composer remove --dev --no-update phpunit/phpunit \
|
||||
&& ([ -z "$COMPOSER_PACKAGES"] || composer require --no-update $COMPOSER_PACKAGES) \
|
||||
&& composer update --no-dev --optimize-autoloader \
|
||||
&& if [ -n "${COMPOSER_PACKAGES}" ] ; then \
|
||||
wget -q ${RAWURL}${RELEASE}/composer.json \
|
||||
&& wget -q ${RAWURL}${RELEASE}/composer.lock \
|
||||
&& composer remove --dev --no-update phpunit/phpunit \
|
||||
&& composer require --no-update ${COMPOSER_PACKAGES} \
|
||||
&& composer update --no-dev --optimize-autoloader ;\
|
||||
fi \
|
||||
&& rm *.md cfg/conf.sample.php composer.* /usr/local/bin/* \
|
||||
&& mv cfg lib tpl vendor /srv \
|
||||
&& mkdir -p /srv/data \
|
||||
|
@ -53,7 +66,7 @@ RUN \
|
|||
&& chmod o+rwx /run /var/lib/nginx /var/lib/nginx/tmp \
|
||||
# Clean up
|
||||
&& rm -rf "${GNUPGHOME}" /tmp/* \
|
||||
&& apk del gnupg php8 php8-curl php8-mbstring php8-phar
|
||||
&& apk del gnupg ${ALPINE_COMPOSER_PACKAGES}
|
||||
|
||||
COPY etc/ /etc/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue