Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Create an auto-deploy file #10

Create an auto-deploy file

Create an auto-deploy file #10

name: Build, Push Docker Image, and Deploy to Azure
on:
push:
branches:
- backend
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: gradlew 실행 권한
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew bootjar
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build Docker image
run: docker build -t anys34/five:latest .
- name: Push Docker image
run: docker push anys34/five:latest
- name: Install Azure CLI
uses: azure/setup-azure-cli@v2
- name: Azure Login
run: |
az login --service-principal \
-u ${{ secrets.AZURE_CLIENT_ID }} \
-p ${{ secrets.AZURE_SECRET }} \
-t ${{ secrets.AZURE_TENANT }}
- name: Deploy to Azure Container Apps
run: |
az account set --subscription ${{ secrets.AZURE_SUBSCRIPTION }}
az containerapp update \
--name five \
--resource-group rg-FiveSelves \
--image anys34/five:latest