Commit c931ac09 authored by Girish Ramakrishnan's avatar Girish Ramakrishnan

tpl/lib/cfg/vendor can all be in readonly rootfs

only the config file needs to be symlinked. it is also protected
by the cfg/.htaccess

/app/data/data contains all the data
parent cfa45825
......@@ -2,27 +2,19 @@ FROM cloudron/base:1.0.0@sha256:147a648a068a2e746644746bbfb42eb7a50d682437cead3c
ARG RELEASE=1.3.1
RUN mkdir -p /app/code /app/pkg /app/data
RUN mkdir -p /app/code /app/pkg
WORKDIR /app/code
COPY start.sh /app/pkg/
RUN \
# Install PrivateBin
cd /tmp \
&& 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 \
&& cd /app/code \
&& tar -xzf /tmp/PrivateBin-${RELEASE}.tar.gz --strip 1 \
curl -Ls https://github.com/PrivateBin/PrivateBin/archive/${RELEASE}.tar.gz | tar -xzf - --strip 1 -C /app/code \
&& mv .htaccess.disabled .htaccess \
&& rm *.md \
&& mv cfg /app/data \
&& mv lib /app/data \
&& mv tpl /app/data \
&& mv vendor /app/data \
&& sed -i "s#define('PATH', '');#define('PATH', '/app/data/');#" index.php \
&& chown -R nobody.www-data /app/code \
&& rm -rf /tmp/*
&& ln -s /app/data/conf.php /app/code/cfg/code.php \
&& ln -s /app/data/data /app/code/data \
&& chown -R www-data.www-data /app/code
# configure apache
RUN rm /etc/apache2/sites-enabled/*
......@@ -45,8 +37,4 @@ RUN crudini --set /etc/php/7.2/apache2/php.ini PHP upload_max_filesize 256M && \
crudini --set /etc/php/7.2/apache2/php.ini Session session.gc_probability 1 && \
crudini --set /etc/php/7.2/apache2/php.ini Session session.gc_divisor 100
RUN chown -R www-data.www-data /app/code
EXPOSE 8000
CMD [ "/app/pkg/start.sh" ]
......@@ -2,28 +2,20 @@
set -eu
# setup waits for apache to start and configures privatebin
setup() {
while [[ ! -f "/var/run/apache2/apache2.pid" ]]; do
echo "Waiting for apache2 to start"
sleep 1
done
mkdir /app/data/data
echo "Creating config"
if [[ ! -f /app/data/cfg/conf.php ]]; then
cp /app/data/cfg/conf.sample.php /app/data/cfg/conf.php
echo "==> Creating config"
if [[ ! -f /app/data/conf.php ]]; then
cp /app/code/cfg/conf.sample.php /app/data/conf.php
# Enable file uploading
sed -i "s#fileupload = false#fileupload = true#" /app/data/cfg/conf.php
fi
# Enable file uploading
sed -i "s#fileupload = false#fileupload = true#" /app/data/conf.php
fi
echo "Changing permissions"
chown -R www-data:www-data /app/data/
echo "==> Changing permissions"
chown -R www-data:www-data /app/data/
echo "Setup done"
}
( setup ) &
echo "==> Staring PrivateBin"
APACHE_CONFDIR="" source /etc/apache2/envvars
rm -f "${APACHE_PID_FILE}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment