2017-04-26 15:16:56 +00:00
|
|
|
FROM php:fpm-alpine
|
2017-03-28 17:46:14 +00:00
|
|
|
|
2018-05-27 21:22:08 +00:00
|
|
|
MAINTAINER PrivateBin <support@privatebin.org>
|
2017-03-28 17:46:14 +00:00
|
|
|
|
2018-05-28 05:31:11 +00:00
|
|
|
ENV RELEASE 1.1.1
|
|
|
|
|
2017-03-28 17:46:14 +00:00
|
|
|
RUN \
|
|
|
|
# Install dependencies
|
|
|
|
apk add --no-cache nginx supervisor \
|
2017-04-26 15:16:56 +00:00
|
|
|
# Install PHP extension: opcache
|
2018-05-27 21:22:08 +00:00
|
|
|
&& docker-php-ext-install -j$(nproc) opcache \
|
2017-04-26 15:16:56 +00:00
|
|
|
&& rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini \
|
2018-05-27 21:22:08 +00:00
|
|
|
# Install PHP extension: gd
|
|
|
|
&& apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev \
|
|
|
|
&& docker-php-ext-configure gd \
|
|
|
|
--with-freetype-dir=/usr/include/ \
|
|
|
|
--with-png-dir=/usr/include/ \
|
|
|
|
--with-jpeg-dir=/usr/include/ \
|
2018-05-28 04:44:54 +00:00
|
|
|
&& docker-php-ext-install -j$(nproc) gd \
|
|
|
|
&& apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev \
|
2017-03-28 17:46:14 +00:00
|
|
|
# Remove (some of the) default nginx config
|
2017-03-28 17:57:54 +00:00
|
|
|
&& rm -f /etc/nginx.conf \
|
2018-05-27 21:22:08 +00:00
|
|
|
&& rm -f /etc/nginx/conf.d/default.conf \
|
2017-03-28 17:46:14 +00:00
|
|
|
&& rm -rf /etc/nginx/sites-* \
|
|
|
|
&& rm -rf /var/log/nginx \
|
|
|
|
# Ensure nginx logs, even if the config has errors, are written to stderr
|
|
|
|
&& rm /var/lib/nginx/logs \
|
|
|
|
&& mkdir -p /var/lib/nginx/logs \
|
|
|
|
&& ln -s /dev/stderr /var/lib/nginx/logs/error.log \
|
2017-03-29 17:40:24 +00:00
|
|
|
# Create folder where the user hook into our default configs
|
|
|
|
&& mkdir -p /etc/nginx/server.d/ \
|
|
|
|
&& mkdir -p /etc/nginx/location.d/ \
|
2017-04-27 12:17:43 +00:00
|
|
|
# Bring php-fpm configs into a more controallable state
|
|
|
|
&& rm /usr/local/etc/php-fpm.d/www.conf.default \
|
|
|
|
&& mv /usr/local/etc/php-fpm.d/docker.conf /usr/local/etc/php-fpm.d/00-docker.conf \
|
|
|
|
&& mv /usr/local/etc/php-fpm.d/www.conf /usr/local/etc/php-fpm.d/10-www.conf \
|
2018-05-28 04:44:54 +00:00
|
|
|
&& mv /usr/local/etc/php-fpm.d/zz-docker.conf /usr/local/etc/php-fpm.d/20-docker.conf \
|
|
|
|
# Install PrivateBin
|
|
|
|
&& apk add --no-cache gnupg \
|
2018-05-28 05:31:11 +00:00
|
|
|
&& export GNUPGHOME="$(mktemp -d)" \
|
|
|
|
&& gpg2 --list-public-keys || /bin/true \
|
|
|
|
&& curl -s https://privatebin.info/key/rugk.asc | gpg2 --import - \
|
2018-05-28 04:44:54 +00:00
|
|
|
&& cd /tmp \
|
2018-05-28 05:31:11 +00:00
|
|
|
&& curl -Ls https://github.com/PrivateBin/PrivateBin/releases/download/${RELEASE}/PrivateBin-${RELEASE}.tar.gz.asc > PrivateBin-${RELEASE}.tar.gz.asc \
|
|
|
|
&& curl -Ls https://github.com/PrivateBin/PrivateBin/archive/${RELEASE}.tar.gz > PrivateBin-${RELEASE}.tar.gz \
|
|
|
|
&& gpg2 --verify PrivateBin-${RELEASE}.tar.gz.asc \
|
|
|
|
&& tar -xzf PrivateBin-${RELEASE}.tar.gz \
|
2018-05-28 04:44:54 +00:00
|
|
|
&& rm -rf /var/www \
|
2018-05-28 05:31:11 +00:00
|
|
|
&& mv /tmp/PrivateBin-${RELEASE} /var/www \
|
2018-05-28 04:44:54 +00:00
|
|
|
&& cd /var/www \
|
2018-05-28 05:31:11 +00:00
|
|
|
&& rm *.md cfg/conf.sample.php \
|
2018-05-28 04:44:54 +00:00
|
|
|
&& mv cfg /srv \
|
|
|
|
&& mv lib /srv \
|
|
|
|
&& mv tpl /srv \
|
|
|
|
&& mv vendor /srv \
|
|
|
|
&& mkdir -p /srv/data \
|
|
|
|
&& sed -i "s#define('PATH', '');#define('PATH', '/srv/');#" index.php \
|
|
|
|
&& chown -R www-data.www-data /var/www /srv/* \
|
2018-05-28 05:31:11 +00:00
|
|
|
&& rm -rf "${GNUPGHOME}" /tmp/* \
|
2018-05-28 04:44:54 +00:00
|
|
|
&& apk del --no-cache gnupg
|
2017-03-28 17:46:14 +00:00
|
|
|
|
|
|
|
WORKDIR /var/www
|
|
|
|
|
|
|
|
ADD etc/ /etc/
|
|
|
|
ADD usr/ /usr/
|
|
|
|
|
2018-05-27 21:22:08 +00:00
|
|
|
# mark dirs as volumes that need to be writable, allows running the container --read-only
|
2018-05-28 05:31:11 +00:00
|
|
|
VOLUME /srv/data /tmp /var/tmp /var/run /var/log
|
2018-05-27 21:22:08 +00:00
|
|
|
|
2017-03-28 17:46:14 +00:00
|
|
|
EXPOSE 80
|
|
|
|
|
2018-05-27 21:22:08 +00:00
|
|
|
ENTRYPOINT ["/usr/bin/supervisord","-c","/etc/supervisord.conf"]
|