-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from m-strzelec/strzelec
Deployment
- Loading branch information
Showing
12 changed files
with
67 additions
and
22 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Build and Deploy to Azure Container Apps | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 21 | ||
|
||
- name: Build with Maven | ||
run: mvn clean package | ||
|
||
- name: Log in to Azure CLI | ||
uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to Azure Container Registry | ||
run: | | ||
echo ${{ secrets.ACR_NAME }} | az acr login --name ${{ secrets.ACR_NAME }} | ||
- name: Build and push Docker image | ||
run: | | ||
docker build -t ${{ secrets.ACR_NAME }}.azurecr.io/tabi-backend:latest . | ||
docker push ${{ secrets.ACR_NAME }}.azurecr.io/tabi-backend:latest | ||
- name: Create Azure Container App Environment | ||
run: | | ||
az containerapp env create --name tabienv --resource-group zzpjtabi --location polandcentral || echo "Environment already exists" | ||
- name: Deploy to Azure Container Apps | ||
run: | | ||
az containerapp create --name tabiapp --resource-group zzpjtabi --environment tabienv --image ${{ secrets.ACR_NAME }}.azurecr.io/tabi-backend:latest --ingress 'external' --target-port 8080 --env-vars POSTGRES_DB=${{ secrets.POSTGRES_SERVER }} POSTGRES_USER=${{ secrets.POSTGRES_USER }} POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} DB_HOSTNAME=${{ secrets.DB_HOSTNAME }} DB_NAME=${{ secrets.POSTGRES_DATABASE }} APP_PROFILE=prod STRIPE_PUBLIC_KEY=${{ secrets.STRIPE_PUBLIC_KEY }} STRIPE_PRIVATE_KEY=${{ secrets.STRIPE_PRIVATE_KEY }} || az containerapp update --name tabiapp --resource-group zzpjtabi --set-env-vars POSTGRES_DB=${{ secrets.POSTGRES_SERVER }} POSTGRES_USER=${{ secrets.POSTGRES_USER }} POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} DB_HOSTNAME=${{ secrets.DB_HOSTNAME }} DB_NAME=${{ secrets.POSTGRES_DATABASE }} APP_PROFILE=prod STRIPE_PUBLIC_KEY=${{ secrets.STRIPE_PUBLIC_KEY }} STRIPE_PRIVATE_KEY=${{ secrets.STRIPE_PRIVATE_KEY }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,3 @@ target/ | |
*.swp | ||
*.un~ | ||
*~ | ||
payments.properties |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
spring.datasource.url=jdbc:postgresql://${DB_HOSTNAME}/${DB_NAME} | ||
spring.datasource.username=${POSTGRES_USER} | ||
spring.datasource.password=${POSTGRES_PASSWORD} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
spring.datasource.url=jdbc:postgresql://${DB_HOSTNAME}/${DB_NAME}?user=${POSTGRES_USER}&password=${POSTGRES_PASSWORD}&sslmode=require |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
api.stripe.public-key=${STRIPE_PUBLIC_KEY} | ||
api.stripe.private-key=${STRIPE_PRIVATE_KEY} |