diff --git a/docker-compose.yml b/docker-compose.yml index 2b7c2c0..ece7f6d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,12 +15,6 @@ services: app: image: cthulhoo/ttrss-fpm-pgsql-static -# build: -# context: -# ./app -# args: -# - OWNER_UID=${OWNER_UID} -# - OWNER_GID=${OWNER_GID} restart: unless-stopped environment: - DB_TYPE=pgsql @@ -38,12 +32,6 @@ services: updater: image: cthulhoo/ttrss-fpm-pgsql-static -# build: -# context: -# ./app -# args: -# - OWNER_UID=${OWNER_UID} -# - OWNER_GID=${OWNER_GID} restart: unless-stopped environment: - DB_TYPE=pgsql @@ -63,7 +51,6 @@ services: web: image: cthulhoo/ttrss-web - #build: ./web restart: unless-stopped ports: - ${HTTP_PORT}:2015 @@ -74,7 +61,6 @@ services: # web-ssl: # image: cthulhoo/ttrss-web-ssl -# build: ./web-ssl # restart: unless-stopped # environment: # - CADDYPATH=/certs diff --git a/app/Dockerfile b/src/app/Dockerfile similarity index 100% rename from app/Dockerfile rename to src/app/Dockerfile diff --git a/src/app/build-prepare.sh b/src/app/build-prepare.sh new file mode 100755 index 0000000..1b5717f --- /dev/null +++ b/src/app/build-prepare.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +DST_DIR=/src/tt-rss +SRC_REPO=https://git.tt-rss.org/fox/tt-rss.git + +if [ ! -d $DST_DIR ]; then + mkdir -p $DST_DIR + git clone $SRC_REPO $DST_DIR +else + cd $DST_DIR && \ + git config core.filemode false && \ + git pull origin master +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 + +mkdir -p /var/www +addgroup -g $OWNER_GID app +adduser -D -h /var/www/html -G app -u $OWNER_UID app + diff --git a/app/index.php b/src/app/index.php similarity index 100% rename from app/index.php rename to src/app/index.php diff --git a/app/startup.sh b/src/app/startup.sh similarity index 100% rename from app/startup.sh rename to src/app/startup.sh diff --git a/app/updater.sh b/src/app/updater.sh similarity index 100% rename from app/updater.sh rename to src/app/updater.sh diff --git a/src/docker-compose.yml b/src/docker-compose.yml new file mode 100644 index 0000000..a6f3d0a --- /dev/null +++ b/src/docker-compose.yml @@ -0,0 +1,94 @@ +version: '3' + +# set database password in .env +# please don't use quote (') or (") symbols in variables + +services: + db: + image: postgres:12-alpine + restart: unless-stopped + volumes: + - db:/var/lib/postgresql/data + environment: + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_USER=${POSTGRES_USER} + + app: + image: cthulhoo/ttrss-fpm-pgsql-static + build: + context: + ./app + args: + - OWNER_UID=${OWNER_UID} + - OWNER_GID=${OWNER_GID} + restart: unless-stopped + environment: + - DB_TYPE=pgsql + - DB_HOST=db + - DB_NAME=${POSTGRES_USER} + - DB_USER=${POSTGRES_USER} + - DB_PASS=${POSTGRES_PASSWORD} + - OWNER_UID=${OWNER_UID} + - OWNER_GID=${OWNER_GID} + - SELF_URL_PATH=${SELF_URL_PATH} + volumes: + - app:/var/www/html + depends_on: + - db + + updater: + image: cthulhoo/ttrss-fpm-pgsql-static + build: + context: + ./app + args: + - OWNER_UID=${OWNER_UID} + - OWNER_GID=${OWNER_GID} + restart: unless-stopped + environment: + - DB_TYPE=pgsql + - DB_HOST=db + - DB_NAME=${POSTGRES_USER} + - DB_USER=${POSTGRES_USER} + - DB_PASS=${POSTGRES_PASSWORD} + - OWNER_UID=${OWNER_UID} + - OWNER_GID=${OWNER_GID} + - SELF_URL_PATH=${SELF_URL_PATH} + volumes: + - app:/var/www/html + depends_on: + - app + user: app + command: /updater.sh + + web: + image: cthulhoo/ttrss-web + build: ./web + restart: unless-stopped + ports: + - ${HTTP_PORT}:2015 + volumes: + - app:/var/www/html:ro + depends_on: + - app + + web-ssl: + image: cthulhoo/ttrss-web-ssl + build: ./web-ssl + restart: unless-stopped + environment: + - CADDYPATH=/certs + - HTTP_HOST=${HTTP_HOST} + ports: + - 80:80 + - 443:443 + volumes: + - app:/var/www/html:ro + - certs:/certs + depends_on: + - app + +volumes: + db: + app: + certs: diff --git a/web-ssl/Caddyfile b/src/web-ssl/Caddyfile similarity index 100% rename from web-ssl/Caddyfile rename to src/web-ssl/Caddyfile diff --git a/web-ssl/Dockerfile b/src/web-ssl/Dockerfile similarity index 100% rename from web-ssl/Dockerfile rename to src/web-ssl/Dockerfile diff --git a/web/Caddyfile b/src/web/Caddyfile similarity index 100% rename from web/Caddyfile rename to src/web/Caddyfile diff --git a/web/Dockerfile b/src/web/Dockerfile similarity index 100% rename from web/Dockerfile rename to src/web/Dockerfile