privatebin/Dockerfile
2022-03-02 21:49:27 +01:00

50 lines
1.5 KiB
Docker

FROM alpine:3.14
LABEL maintainer="andrey.arapov@nixaid.com"
ENV RELEASE 1.3.5
ENV PBURL https://github.com/PrivateBin/PrivateBin/
RUN \
# Install dependencies
apk add --no-cache gnupg php7-fpm php7-json php7-gd \
php7-opcache php7-pdo_mysql php7-pdo_pgsql tzdata \
&& apk upgrade --no-cache \
# Install PrivateBin
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg2 --list-public-keys || /bin/true \
&& wget -qO - https://privatebin.info/key/release.asc | gpg2 --import - \
&& cd /tmp \
&& 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 \
&& mkdir /var/www \
&& cd /var/www \
&& tar -xzf /tmp/${RELEASE}.tar.gz --strip 1 \
&& rm *.md cfg/conf.sample.php \
&& mv cfg lib tpl vendor /srv \
&& mkdir /srv/data \
&& sed -i "s#define('PATH', '');#define('PATH', '/srv/');#" index.php \
&& rm -rf "${GNUPGHOME}" /tmp/* \
&& apk del gnupg
# nginx group id must match to the nginx group id of the container running nginx (e.g. "nginx:mainline-alpine")
ENV NGINXGID 101
RUN addgroup -S -g $NGINXGID nginx
# Create the application user under which PHP-FPM will run
ENV USER user
ENV UID 1000
ENV HOME /home/$USER
ENV DATA /var/www
RUN adduser -D -u $UID -h $HOME -s /bin/true $USER && \
mkdir -p $DATA && \
chown -Rh $USER:$NGINXGID $DATA /srv
# Copy the php-fpm & nginx configs
COPY etc/ /etc/
WORKDIR $DATA
USER $USER
CMD php-fpm7 -F