Skip to content

Commit

Permalink
changed approach
Browse files Browse the repository at this point in the history
  • Loading branch information
Gissebass committed Nov 9, 2024
1 parent 42d531a commit dfa2cb0
Showing 1 changed file with 15 additions and 32 deletions.
47 changes: 15 additions & 32 deletions .github/workflows/test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,19 @@ on:
workflow_dispatch:

jobs:
build:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Java version
uses: actions/setup-java@v1
with:
java-version: "21"

- name: Build Docker backend image
run: |
docker build \
--build-arg DATABASE_USERNAME=${{ secrets.HILFLINGDB_USERNAME }} \
--build-arg DATABASE_URL=${{ secrets.HILFLINGDB_URL_DEV }} \
--build-arg DATABASE_PASSWORD=${{ secrets.HILFLINGDB_PASSWORD }} \
-t hilfling-backend:${{ github.sha }} .

- name: Log in to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_LOGIN_SERVER }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}

- name: Push Docker backend image to Azure Container Registry
run: |
docker tag hilfling-backend:${{ github.sha }} ${{ secrets.ACR_LOGIN_SERVER }}/hilfling-backend:${{ github.sha }}
docker push ${{ secrets.ACR_LOGIN_SERVER }}/hilfling-backend:${{ github.sha }}
deploy:
runs-on: ubuntu-latest
needs: build

steps:
# Checkout the repository code
- name: Checkout code
uses: actions/checkout@v2

# Set up Docker Buildx for multi-platform builds (optional)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Azure CLI Login
uses: azure/login@v2
with:
Expand All @@ -55,6 +32,13 @@ jobs:
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}

# Build and Push Docker Image to ACR
- name: Build and push Docker image to ACR
run: |
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/hilfling-backend:${{ github.sha }} .
docker push ${{ secrets.ACR_LOGIN_SERVER }}/hilfling-backend:${{ github.sha }}
- name: Delete existing Azure Container Apps (if any)
run: |
az containerapp delete \
Expand All @@ -74,7 +58,6 @@ jobs:
DATABASE_URL=${{ secrets.HILFLINGDB_URL_DEV }} \
DATABASE_PASSWORD=${{ secrets.HILFLINGDB_PASSWORD }} \
--ingress 'external' \
--query properties.configuration.ingress.fqdn
--target-port 8000 \

0 comments on commit dfa2cb0

Please sign in to comment.