mirror of
				https://git.tt-rss.org/fox/ttrss-docker-compose
				synced 2025-11-04 09:34:13 +01:00 
			
		
		
		
	initial: static version
This commit is contained in:
		
							parent
							
								
									fa73a498a3
								
							
						
					
					
						commit
						3da3cbed21
					
				
					 3 changed files with 32 additions and 21 deletions
				
			
		| 
						 | 
				
			
			@ -6,17 +6,18 @@ RUN apk add --no-cache php7 php7-fpm \
 | 
			
		|||
	php7-intl php7-xml php7-curl php7-session \
 | 
			
		||||
	php7-dom php7-fileinfo php7-json \
 | 
			
		||||
	php7-pcntl php7-posix \
 | 
			
		||||
	git postgresql-client sudo
 | 
			
		||||
	git postgresql-client sudo rsync
 | 
			
		||||
 | 
			
		||||
ADD startup.sh /
 | 
			
		||||
ADD updater.sh /
 | 
			
		||||
ADD index.php /
 | 
			
		||||
ADD build-prepare.sh /
 | 
			
		||||
 | 
			
		||||
RUN sed -i.bak 's/^listen = 127.0.0.1:9000/listen = 9000/' /etc/php7/php-fpm.d/www.conf
 | 
			
		||||
 | 
			
		||||
ARG OWNER_UID
 | 
			
		||||
ARG OWNER_GID
 | 
			
		||||
 | 
			
		||||
RUN mkdir -p /var/www && addgroup -g ${OWNER_GID} app && adduser -D -h /var/www/html -G app -u ${OWNER_UID} app
 | 
			
		||||
RUN sh -c /build-prepare.sh
 | 
			
		||||
 | 
			
		||||
CMD /startup.sh
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,37 +6,42 @@ while ! pg_isready -h $DB_HOST -U $DB_USER; do
 | 
			
		|||
done
 | 
			
		||||
 | 
			
		||||
DST_DIR=/var/www/html/tt-rss
 | 
			
		||||
SRC_REPO=https://git.tt-rss.org/fox/tt-rss.git
 | 
			
		||||
SRC_DIR=/src/tt-rss/
 | 
			
		||||
 | 
			
		||||
[ -e $DST_DIR ] && rm -f $DST_DIR/.app_is_ready
 | 
			
		||||
 | 
			
		||||
export PGPASSWORD=$DB_PASS 
 | 
			
		||||
 | 
			
		||||
[ ! -e /var/www/html/index.php ] && cp /index.php /var/www/html
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
	rsync -aP \
 | 
			
		||||
		$SRC_DIR/ $DST_DIR/
 | 
			
		||||
else
 | 
			
		||||
	cd $DST_DIR && \
 | 
			
		||||
		git config core.filemode false && \
 | 
			
		||||
		git pull origin master
 | 
			
		||||
	rsync -aP --delete \
 | 
			
		||||
		--exclude cache \
 | 
			
		||||
		--exclude lock \
 | 
			
		||||
		--exclude feed-icons \
 | 
			
		||||
		--exclude plugins.local \
 | 
			
		||||
		--exclude themes.local \
 | 
			
		||||
		$SRC_DIR/ $DST_DIR/
 | 
			
		||||
 | 
			
		||||
	rsync -aP --delete \
 | 
			
		||||
		$SRC_DIR/plugins.local/nginx_xaccel $DST_DIR/plugins.local/nginx_xaccel
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ ! -d $DST_DIR/plugins.local/nginx_xaccel ]; then
 | 
			
		||||
	git clone https://git.tt-rss.org/fox/ttrss-nginx-xaccel.git $DST_DIR/plugins.local/nginx_xaccel
 | 
			
		||||
else
 | 
			
		||||
	cd $DST_DIR/plugins.local/nginx_xaccel && \
 | 
			
		||||
		git config core.filemode false && \
 | 
			
		||||
	  	git pull origin master
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
chown -R $OWNER_UID:$OWNER_GID $DST_DIR
 | 
			
		||||
for d in cache lock feed-icons plugins.local themes.local; do
 | 
			
		||||
	mkdir -p $DST_DIR/$d
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
for d in cache lock feed-icons; do
 | 
			
		||||
	chmod -R 777 $DST_DIR/$d
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
chown -R $OWNER_UID:$OWNER_GID $DST_DIR
 | 
			
		||||
 | 
			
		||||
PSQL="psql -q -h $DB_HOST -U $DB_USER $DB_NAME"
 | 
			
		||||
 | 
			
		||||
$PSQL -c "create extension if not exists pg_trgm"
 | 
			
		||||
 | 
			
		||||
RESTORE_SCHEMA=/var/www/html/tt-rss/backups/restore-schema.sql.gz
 | 
			
		||||
| 
						 | 
				
			
			@ -68,5 +73,7 @@ else
 | 
			
		|||
		-i.bak $DST_DIR/config.php
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
touch $DST_DIR/.app_is_ready
 | 
			
		||||
 | 
			
		||||
exec /usr/sbin/php-fpm7 -F
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,8 @@
 | 
			
		|||
#!/bin/sh -ex
 | 
			
		||||
 | 
			
		||||
# wait for the app container to delete .app_is_ready and perform rsync, etc.
 | 
			
		||||
sleep 30
 | 
			
		||||
 | 
			
		||||
while ! pg_isready -h $DB_HOST -U $DB_USER; do
 | 
			
		||||
	echo waiting until $DB_HOST is ready...
 | 
			
		||||
	sleep 3
 | 
			
		||||
| 
						 | 
				
			
			@ -7,8 +10,8 @@ done
 | 
			
		|||
 | 
			
		||||
DST_DIR=/var/www/html/tt-rss
 | 
			
		||||
 | 
			
		||||
while [ ! -s $DST_DIR/config.php ]; do
 | 
			
		||||
	echo waiting for $DST_DIR/config.php...
 | 
			
		||||
while [ ! -s $DST_DIR/config.php -a -e $DST_DIR/.app_is_ready ]; do
 | 
			
		||||
	echo waiting for app container...
 | 
			
		||||
	sleep 3
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue