.github/workflows/deploy-traefik.yml #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy JAR app to Azure Container Instance - hilfling-backend | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Docker Traefik image | |
run: | | |
docker build -t hilfling-traefik:${{ github.sha }} -f traefik/Dockerfile . | |
- 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 Traefik image to Azure Container Registry | |
run: | | |
docker tag hilfling-traefik:${{ github.sha }} ${{ secrets.ACR_LOGIN_SERVER }}/my-traefik:${{ github.sha }} | |
docker push ${{ secrets.ACR_LOGIN_SERVER }}/my-traefik:${{ github.sha }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Azure CLI Login | |
uses: azure/login@v2 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Deploy Traefik container | |
run: | | |
az container create \ | |
--resource-group hilfling-backend_group \ | |
--name traefik \ | |
--image ${{ secrets.ACR_LOGIN_SERVER }}/my-traefik:${{ github.sha }} \ | |
--registry-login-server ${{ secrets.ACR_LOGIN_SERVER }} \ | |
--registry-username ${{ secrets.ACR_USERNAME }} \ | |
--registry-password ${{ secrets.ACR_PASSWORD }} \ | |
--ip-address public \ | |
--dns-name-label hilfling-traefik \ | |
--ports 8080 8081 443 \ | |
--environment-variables TRAEFIK_API=true TRAEFIK_API_DASHBOARD=true TRAEFIK_ENTRYPOINTS_HTTP_ADDRESS=:8080 TRAEFIK_ENTRYPOINTS_HTTPS_ADDRESS=:443 TRAEFIK_PROVIDERS_DOCKER=true |