1
0
Fork 0
mirror of https://git.tt-rss.org/fox/ttrss-docker-compose synced 2025-06-09 10:59:51 +02:00
This commit is contained in:
Andrew Dolgov 2019-11-15 15:51:55 +03:00
commit a1f1862ba2
8 changed files with 185 additions and 0 deletions

15
app/Dockerfile Normal file
View file

@ -0,0 +1,15 @@
FROM alpine:3.9
EXPOSE 9000/tcp
RUN apk add --no-cache php7 php7-fpm \
php7-pdo php7-gd php7-pgsql php7-pdo_pgsql php7-mbstring \
php7-intl php7-xml php7-curl php7-session \
php7-dom php7-fileinfo php7-json \
git postgresql-client dcron sudo
ADD startup.sh /
ADD scripts/update /etc/periodic/15min/
RUN sed -i.bak 's/^listen = 127.0.0.1:9000/listen = 9000/' /etc/php7/php-fpm.d/www.conf
CMD /startup.sh

7
app/scripts/update Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
DST_DIR=/var/www/html/tt-rss
if [ -s $DST_DIR/config.php ]; then
sudo -u nobody $DST_DIR/update.php --feeds
fi

44
app/startup.sh Executable file
View file

@ -0,0 +1,44 @@
#!/bin/sh -ex
OWNER=nobody
DST_DIR=/var/www/html/tt-rss
SRC_REPO=https://git.tt-rss.org/fox/tt-rss.git
export PGPASSWORD=$DB_PASS
PSQL="psql -q -h $DB_HOST -U $DB_USER $DB_NAME"
if [ ! -d $DST_DIR ]; then
mkdir -p $DST_DIR
git clone $SRC_REPO $DST_DIR
else
cd $DST_DIR && git pull origin master
fi
chown -R $OWNER $DST_DIR
chmod +x /etc/periodic/15min/*
for d in cache lock feed-icons; do
chmod -R 777 $DST_DIR/$d
done
if ! $PSQL -c 'select * from ttrss_version'; then
$PSQL < /var/www/html/tt-rss/schema/ttrss_schema_pgsql.sql
fi
if [ ! -s $DST_DIR/config.php ]; then
SELF_URL_PATH=$(echo $SELF_URL_PATH | sed -e 's/[\/&]/\\&/g')
sed \
-e "s/define('DB_HOST'.*/define('DB_HOST','$DB_HOST');/" \
-e "s/define('DB_USER'.*/define('DB_USER','$DB_USER');/" \
-e "s/define('DB_NAME'.*/define('DB_NAME','$DB_NAME');/" \
-e "s/define('DB_PASS'.*/define('DB_PASS','$DB_PASS');/" \
-e "s/define('SELF_URL_PATH'.*/define('SELF_URL_PATH','$SELF_URL_PATH');/" \
< $DST_DIR/config.php-dist > $DST_DIR/config.php
fi
crond &
exec /usr/sbin/php-fpm7 -F