From 7f0d9553dfc450f18e2560e74b4b93a222fc6ae0 Mon Sep 17 00:00:00 2001 From: Amos Laboso Date: Wed, 12 Jul 2023 08:28:30 +0300 Subject: [PATCH] OHRI-1616: OHRI-WORKING Back to life --- .github/workflows/ohri-working.yml | 119 +++++++++++++++++++++++++++++ distro/distro.properties | 2 +- docker-compose.yml | 6 +- 3 files changed, 123 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ohri-working.yml diff --git a/.github/workflows/ohri-working.yml b/.github/workflows/ohri-working.yml new file mode 100644 index 000000000..6874fabd5 --- /dev/null +++ b/.github/workflows/ohri-working.yml @@ -0,0 +1,119 @@ +name: OHRI Working with O3 Images + +on: + push: + branches: + - working + pull_request: + types: [opened, synchronize, closed] +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +jobs: + docker_setup: + runs-on: ubuntu-latest + if: (github.event_name == 'push' || github.event.pull_request.merged) + + steps: + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + docker_ohri_working_backend: + runs-on: ubuntu-latest + needs: docker_setup + + steps: + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ secrets.DOCKERHUB_USERNAME }}/ohri-working-backend-2_6:next,${{ secrets.DOCKERHUB_USERNAME }}/ohri-working-backend-2_6:ci_${{ github.run_number }} + cache-from: type=inline,ref=user/app:buildcache + cache-to: type=inline,ref=user/app:buildcache,mode=max + + docker_ohri_working_frontend: + runs-on: ubuntu-latest + needs: docker_setup + + steps: + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: ./frontend + file: ./frontend/Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ secrets.DOCKERHUB_USERNAME }}/ohri-working-frontend:next,${{ secrets.DOCKERHUB_USERNAME }}/ohri-working-frontend:ci_${{ github.run_number }} + cache-from: type=inline,ref=user/app:buildcache + cache-to: type=inline,ref=user/app:buildcache,mode=max + + docker_ohri_working_gateway: + runs-on: ubuntu-latest + needs: docker_setup + + steps: + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build and push + id: build-and-push + uses: docker/build-push-action@v4 + with: + context: ./gateway + file: ./gateway/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/ohri-working-proxy:next,${{ secrets.DOCKERHUB_USERNAME }}/ohri-working-proxy:ci_${{ github.run_number }} + cache-from: type=gha + cache-to: type=gha,mode=max + - name: Save image digest + run: echo "::set-output name=image::${{ steps.build-and-push.output.digest }}" diff --git a/distro/distro.properties b/distro/distro.properties index 5e7322204..3bba099f1 100644 --- a/distro/distro.properties +++ b/distro/distro.properties @@ -1,4 +1,4 @@ -name=OHRI 3.x distro (Dev) +name=OHRI 3.x distro (Working) version=3.0.0 war.openmrs=${openmrs.version} omod.initializer=${initializer.version} diff --git a/docker-compose.yml b/docker-compose.yml index 8107b4c28..b71c8dd2b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" services: gateway: - image: histacoohri/ohri-dev-proxy:next + image: histacoohri/ohri-working-proxy:next depends_on: - frontend - backend @@ -10,7 +10,7 @@ services: - "80:80" frontend: - image: histacoohri/ohri-dev-frontend:next + image: histacoohri/ohri-working-frontend:next environment: SPA_PATH: /openmrs/spa API_URL: /openmrs @@ -25,7 +25,7 @@ services: - ./frontend/ohri-config.json:/usr/share/nginx/html/ohri-config.json backend: - image: histacoohri/ohri-dev-backend-2_6:next + image: histacoohri/ohri-working-backend-2_6:next depends_on: - db environment: