From 43e7c0019c8b8721f2ec7e9307cf651585743f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Cant=C3=B9?= Date: Wed, 3 May 2023 09:16:15 +0200 Subject: [PATCH] specific configurations for osmit-tm4 add osmit build --- .github/workflows/osmit-build.yml | 41 +++++++++++++++++++++++++++++++ docker-compose.override.yml | 3 +++ docker-compose.yml | 14 ++++++----- 3 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/osmit-build.yml diff --git a/.github/workflows/osmit-build.yml b/.github/workflows/osmit-build.yml new file mode 100644 index 0000000000..3b909e7fbe --- /dev/null +++ b/.github/workflows/osmit-build.yml @@ -0,0 +1,41 @@ +name: CI + +on: + push: + branches: + - osm-ita + tags: + - v* + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@main + + - name: 'Login to GitHub Container Registry' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + - name: Set output + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + - name: 'Build Backend Image' + env: + RELEASE_VERSION: ${{ steps.vars.outputs.tag }} + run: | + docker build . -f ./scripts/docker/Dockerfile.backend --tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-backend:$GITHUB_SHA --tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-backend:$RELEASE_VERSION + docker push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-backend:$GITHUB_SHA + docker push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-backend:$RELEASE_VERSION + - name: 'Build Frontend Image' + env: + RELEASE_VERSION: ${{ steps.vars.outputs.tag }} + FRONTEND_ENV: ${{ vars.FRONTEND_ENV }} + run: | + echo "$FRONTEND_ENV" > tasking-manager.env + docker build . -f ./scripts/docker/Dockerfile.frontend --tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-frontend:$GITHUB_SHA --tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-frontend:$RELEASE_VERSION + docker push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-frontend:$GITHUB_SHA + docker push ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/osmit-tm-frontend:$RELEASE_VERSION diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 3cfcc866c3..7f7cc5d7cf 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -12,6 +12,9 @@ services: <<: *backend volumes: - .:/usr/src/app + labels: + - traefik.http.routers.backend.rule=Host(`localhost`) && PathPrefix(`/api/`) + - traefik.http.services.backend.loadbalancer.server.port=5000 # Migration service migration: diff --git a/docker-compose.yml b/docker-compose.yml index 459512fdd6..d4df0e8568 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.4" x-backend-config: &backend - image: hotosm-tasking-manager:backend + image: ghcr.io/osmitalia/osmit-tm-backend:v4.6.2-hotfix env_file: ${ENV_FILE:-tasking-manager.env} depends_on: - postgresql @@ -18,7 +18,7 @@ services: container_name: backend restart: always labels: - - traefik.http.routers.backend.rule=(Host(`127.0.0.1`) || Host(`localhost`)) && PathPrefix(`/api/`) + - traefik.http.routers.backend.rule=Host(`osmit-tm4.wmcloud.org`) && PathPrefix(`/api/`) - traefik.http.services.backend.loadbalancer.server.port=5000 migration: @@ -28,21 +28,23 @@ services: command: flask db upgrade frontend: - image: hotosm-tasking-manager:frontend + image: ghcr.io/osmitalia/osmit-tm-frontend:v4.6.2-hotfix restart: always networks: - tm-web labels: - - traefik.http.routers.frontend.rule=Host(`127.0.0.1`) || Host(`localhost`) - - traefik.http.services.frontend.loadbalancer.server.port=3000 + - traefik.http.routers.frontend.rule=Host(`osmit-tm4.wmcloud.org`) + - traefik.http.services.frontend.loadbalancer.server.port=80 postgresql: - image: postgis/postgis:14-3.3 + image: mdillon/postgis:11 container_name: postgresql restart: always env_file: ${ENV_FILE:-tasking-manager.env} networks: - tm-web + volumes: + - /srv/postgresql:/var/lib/postgresql/data traefik: image: traefik:v2.10