diff --git a/.github/workflows/azure-dev.yml b/.github/workflows/azure-dev.yml index 772df8d..2b9836b 100644 --- a/.github/workflows/azure-dev.yml +++ b/.github/workflows/azure-dev.yml @@ -1,16 +1,11 @@ +name: Deploy to Azure Container Apps + on: workflow_dispatch: push: - # Run when commits are pushed to mainline branch (main or master) - # Set this to the mainline branch you are using branches: - backend -# GitHub Actions workflow to deploy to Azure using azd -# To configure required secrets for connecting to Azure, simply run `azd pipeline config` - -# Set up permissions for deploying with secretless Azure federated credentials -# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication permissions: id-token: write contents: read @@ -22,49 +17,72 @@ jobs: AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} - AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }} + AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }} AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} + AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }} + steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 - - uses: actions/checkout@v3 - name: Set up JDK 17 uses: actions/setup-java@v3 with: java-version: '17' distribution: 'temurin' - - name: Run Gradle Build + - name: Set yml file + uses: microsoft/variable-substitution@v1 + with: + files: src/main/resources/application.yml + env: + spring.datasource.url: ${{ secrets.DB_URL }} + spring.datasource.username: ${{ secrets.DB_USERNAME }} + spring.datasource.password: ${{ secrets.DB_PASSWORD }} + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle run: ./gradlew build + - name: Docker build + run: | + echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin + docker build -t ${{ secrets.DOCKER_USERNAME }}/uiseong-come-on . + docker push ${{ secrets.DOCKER_USERNAME }}/uiseong-come-on:latest + + - name: Install azd + uses: Azure/setup-azd@v1.0.0 + - name: Log in with Azure (Federated Credentials) if: ${{ env.AZURE_CLIENT_ID != '' }} run: | - azd auth login ` - --client-id "$Env:AZURE_CLIENT_ID" ` - --federated-credential-provider "github" ` - --tenant-id "$Env:AZURE_TENANT_ID" - shell: pwsh + azd auth login \ + --client-id "${{ env.AZURE_CLIENT_ID }}" \ + --federated-credential-provider "github" \ + --tenant-id "${{ env.AZURE_TENANT_ID }}" - name: Log in with Azure (Client Credentials) if: ${{ env.AZURE_CREDENTIALS != '' }} run: | - $info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable; + $info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable Write-Host "::add-mask::$($info.clientSecret)" - - azd auth login ` - --client-id "$($info.clientId)" ` - --client-secret "$($info.clientSecret)" ` + + azd auth login \ + --client-id "$($info.clientId)" \ + --client-secret "$($info.clientSecret)" \ --tenant-id "$($info.tenantId)" shell: pwsh env: - AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} + AZURE_CREDENTIALS: ${{ env.AZURE_CREDENTIALS }} - name: Provision Infrastructure - run: azd provision --no-prompt + run: | + azd provision --environment ${{ env.AZURE_ENV_NAME }} --no-prompt env: AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }} - name: Deploy Application - run: azd deploy --no-prompt + run: | + azd deploy --environment ${{ env.AZURE_ENV_NAME }} --no-prompt \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 9e76cd6..35ff802 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,26 +1,10 @@ -version: "3" +version: '3.8' + services: - backend: + hackerground: build: - context: ./server + context: . dockerfile: Dockerfile restart: always ports: - - 8080:8080 - networks: - - network - -# frontend: -# build: -# context: ./web -# dockerfile: Dockerfile -# restart: always -# ports: -# - 80:3000 -# depends_on: -# - backend -# networks: -# - network - -networks: - network: \ No newline at end of file + - 8080:8080 \ No newline at end of file diff --git a/src/main/kotlin/com/byebye/chapterTwo/domain/gooin/controller/GooinController.kt b/src/main/kotlin/com/byebye/chapterTwo/domain/gooin/controller/GooinController.kt index d1dc2fb..1f13618 100644 --- a/src/main/kotlin/com/byebye/chapterTwo/domain/gooin/controller/GooinController.kt +++ b/src/main/kotlin/com/byebye/chapterTwo/domain/gooin/controller/GooinController.kt @@ -31,4 +31,4 @@ class GooinController( return gooinService.editGooin(id,dto) } -} \ No newline at end of file +}