From 9a9c422329f0cc4260869ce51c5d35454496ca57 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Fri, 10 Nov 2023 09:59:34 +0000 Subject: [PATCH] build: remove default script domain init (only if var set) --- .github/workflows/build_proxy_imgs.yml | 10 +++++++ docker-compose.main.yml | 40 +++++++++++++------------- nginx/Dockerfile | 8 +++++- nginx/build_imgs.sh | 11 +++++++ 4 files changed, 48 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build_proxy_imgs.yml b/.github/workflows/build_proxy_imgs.yml index 55b5e47050..5f99d2ce2d 100644 --- a/.github/workflows/build_proxy_imgs.yml +++ b/.github/workflows/build_proxy_imgs.yml @@ -40,6 +40,16 @@ jobs: extra_build_args: | NGINX_TAG=${{ vars.NGINX_TAG }} + build-proxy-main-plus-script: + uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.2.2 + with: + context: nginx + build_target: main-plus-script + image_tags: | + "ghcr.io/${{ github.repository }}/proxy:main-plus-script" + extra_build_args: | + NGINX_TAG=${{ vars.NGINX_TAG }} + build-proxy-dev: uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.2.2 with: diff --git a/docker-compose.main.yml b/docker-compose.main.yml index fca7242ba7..d088ea2fdd 100644 --- a/docker-compose.main.yml +++ b/docker-compose.main.yml @@ -19,28 +19,28 @@ version: "3" volumes: fmtm_frontend: - name: fmtm-frontend-${GIT_BRANCH} + name: fmtm-frontend-main fmtm_db_data: - name: fmtm-db-data-${GIT_BRANCH} + name: fmtm-db-data-main fmtm_logs: - name: fmtm-logs-${GIT_BRANCH} + name: fmtm-logs-main fmtm_images: - name: fmtm-images-${GIT_BRANCH} + name: fmtm-images-main fmtm_tiles: - name: fmtm-tiles-${GIT_BRANCH} + name: fmtm-tiles-main certs: - name: fmtm-certs-${GIT_BRANCH} + name: fmtm-certs-main certbot_data: - name: fmtm-certbot-data-${GIT_BRANCH} + name: fmtm-certbot-data-main networks: fmtm-net: - name: fmtm-${GIT_BRANCH} + name: fmtm-main services: proxy: - image: "ghcr.io/hotosm/fmtm/proxy:${GIT_BRANCH}" - container_name: fmtm-${GIT_BRANCH} + image: "ghcr.io/hotosm/fmtm/proxy:main${FMTM_SCRIPT_DOMAIN:+-plus-script}" + container_name: fmtm-main depends_on: api: condition: service_started @@ -64,8 +64,8 @@ services: restart: "unless-stopped" api: - image: "ghcr.io/hotosm/fmtm/backend:${GIT_BRANCH}" - container_name: fmtm-api-${GIT_BRANCH} + image: "ghcr.io/hotosm/fmtm/backend:main" + container_name: fmtm-api-main volumes: - fmtm_logs:/opt/logs - fmtm_images:/opt/app/images @@ -89,9 +89,9 @@ services: context: src/frontend dockerfile: prod.dockerfile args: - APP_VERSION: ${GIT_BRANCH} + APP_VERSION: main VITE_API_URL: https://${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}} - container_name: fmtm-ui-${GIT_BRANCH} + container_name: fmtm-ui-main volumes: - fmtm_frontend:/frontend network_mode: none @@ -99,7 +99,7 @@ services: fmtm-db: image: "postgis/postgis:${POSTGIS_TAG:-14-3.4-alpine}" - container_name: fmtm-db-${GIT_BRANCH} + container_name: fmtm-db-main volumes: - fmtm_db_data:/var/lib/postgresql/data/ environment: @@ -119,8 +119,8 @@ services: retries: 3 migrations: - image: "ghcr.io/hotosm/fmtm/backend:${GIT_BRANCH}" - container_name: fmtm-migrations-${GIT_BRANCH} + image: "ghcr.io/hotosm/fmtm/backend:main" + container_name: fmtm-migrations-main depends_on: fmtm-db: condition: service_healthy @@ -132,8 +132,8 @@ services: restart: "on-failure:3" backups: - image: "ghcr.io/hotosm/fmtm/backend:${GIT_BRANCH}" - container_name: fmtm-backups-${GIT_BRANCH} + image: "ghcr.io/hotosm/fmtm/backend:main" + container_name: fmtm-backups-main depends_on: fmtm-db: condition: service_healthy @@ -152,7 +152,7 @@ services: certbot: image: "ghcr.io/hotosm/fmtm/proxy:certs-init-main" - container_name: fmtm-cert-renew-${GIT_BRANCH} + container_name: fmtm-cert-renew-main volumes: - certs:/etc/letsencrypt - certbot_data:/var/www/certbot diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 6f8b094cb2..7d79188003 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -118,7 +118,13 @@ FROM base as main # API & Frontend only COPY templates/fmtm.conf.template \ templates/api.conf.template \ - templates/script.conf.template \ + /etc/nginx/templates/ + + + +FROM main as main-plus-script +# Add install script +COPY templates/script.conf.template \ /etc/nginx/templates/ diff --git a/nginx/build_imgs.sh b/nginx/build_imgs.sh index bd9a514d63..419637ba74 100644 --- a/nginx/build_imgs.sh +++ b/nginx/build_imgs.sh @@ -61,3 +61,14 @@ docker build nginx \ if [[ -n "$PUSH_IMGS" ]]; then docker push "ghcr.io/hotosm/fmtm/proxy:main" fi + +# Main plus script proxy +echo "Building proxy:main-plus-script" +docker build nginx \ + --tag "ghcr.io/hotosm/fmtm/proxy:main-plus-script" \ + --target main-plus-script \ + --build-arg NGINX_TAG="${NGINX_TAG:-1.25.2}" + +if [[ -n "$PUSH_IMGS" ]]; then + docker push "ghcr.io/hotosm/fmtm/proxy:main-plus-script" +fi