Skip to content

Commit

Permalink
test deploy using docker-compose with env variable inject during dock…
Browse files Browse the repository at this point in the history
…er compose up
  • Loading branch information
xeroxis-xs committed Sep 30, 2024
1 parent 652515f commit 90cda20
Showing 1 changed file with 53 additions and 37 deletions.
90 changes: 53 additions & 37 deletions .github/workflows/main_eduquest-frontend.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,53 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy container app to Azure Web App - eduquest-frontend
name: Build and Push Docker Image

on:
push:
branches:
- main
workflow_dispatch:

env:
DOCKERHUB_REPO: xeroxisxs/eduquest-frontend-nextjs

jobs:
build:
build-push:
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to registry
uses: docker/login-action@v2
with:
registry: https://index.docker.io/v1/
username: ${{ secrets.AzureAppService_ContainerUsername_a98bdbabc2e2428b9155d8b4ba9c5b3e }}
password: ${{ secrets.AzureAppService_ContainerPassword_2a199e8f8ca248a49903ae6a9d14b48f }}

- name: Build and push container image to registry
uses: docker/build-push-action@v3
with:
push: true
tags: index.docker.io/${{ secrets.AzureAppService_ContainerUsername_a98bdbabc2e2428b9155d8b4ba9c5b3e }}/eduquest-frontend-reactjs:${{ github.sha }}
file: ./Dockerfile
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Lowercase the repo name and username
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

- name: Build and Push Docker Image to Docker Hub
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
${{ env.DOCKERHUB_REPO }}:${{ github.sha }}
${{ env.DOCKERHUB_REPO }}:latest
file: ./Dockerfile

# - name: Build and push container image to registry
# uses: docker/build-push-action@v3
# with:
# push: true
# tags: index.docker.io/${{ secrets.AzureAppService_ContainerUsername_a98bdbabc2e2428b9155d8b4ba9c5b3e }}/eduquest-frontend-reactjs:${{ github.sha }}
# file: ./Dockerfile
# build-args: |
# NEXT_PUBLIC_BACKEND_URL=${{ secrets.NEXT_PUBLIC_BACKEND_URL }}
# NEXT_PUBLIC_AZURE_CLIENT_ID=${{ secrets.NEXT_PUBLIC_AZURE_CLIENT_ID }}
Expand All @@ -40,20 +56,20 @@ jobs:
# NEXT_PUBLIC_SITE_URL=${{ secrets.NEXT_PUBLIC_SITE_URL }}
# NEXT_PUBLIC_LOGIN_REQUEST_SCOPE=${{ secrets.NEXT_PUBLIC_LOGIN_REQUEST_SCOPE }}

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'eduquest-frontend'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_c8b70da7da2d4de0877a073727a89bdc }}
images: 'index.docker.io/${{ secrets.AzureAppService_ContainerUsername_a98bdbabc2e2428b9155d8b4ba9c5b3e }}/eduquest-frontend-reactjs:${{ github.sha }}'

# deploy:
# runs-on: ubuntu-latest
# needs: build
# environment:
# name: 'production'
# url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
#
# steps:
# - name: Deploy to Azure Web App
# id: deploy-to-webapp
# uses: azure/webapps-deploy@v2
# with:
# app-name: 'eduquest-frontend'
# slot-name: 'production'
# publish-profile: ${{ secrets.AzureAppService_PublishProfile_c8b70da7da2d4de0877a073727a89bdc }}
# images: 'index.docker.io/${{ secrets.AzureAppService_ContainerUsername_a98bdbabc2e2428b9155d8b4ba9c5b3e }}/eduquest-frontend-reactjs:${{ github.sha }}'
#

0 comments on commit 90cda20

Please sign in to comment.