Skip to content
name: Build and Push Docker Image to Azure Container Registry
on:
push:
branches:
- 'feature/**'
env:
DOTNET_VERSION: "8.0"
jobs:
build:
runs-on: ubuntu-latest
name: Build
container:
image: mcr.microsoft.com/dotnet/sdk:8.0
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Dotnet restore
working-directory: ./Bouvet.Developer.Survey.Backend
run: dotnet restore Bouvet.Developer.Survey.Backend.generated.sln
- name: Build with dotnet
working-directory: ./Bouvet.Developer.Survey.Backend
run: dotnet build Bouvet.Developer.Survey.Backend.generated.sln --configuration Release --no-restore
- name: Publish
working-directory: ./Bouvet.Developer.Survey.Backend
run: dotnet publish Bouvet.Developer.Survey.Backend.generated.sln --configuration Release --no-build
create-docker-image:
runs-on: ubuntu-latest
name: Create Docker Image
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build the Docker image
working-directory: ./Bouvet.Developer.Survey.Backend/Bouvet.Developer.Survey.Api
run: docker build . --file Dockerfile --tag test:$(date +%s)
# steps:
# # Checkout the code
# - name: Checkout code
# uses: actions/checkout@v3
# # Log in to Azure Container Registry
# - name: Log in to Azure Container Registry
# uses: azure/docker-login@v1
# with:
# login-server: ${{ secrets.AZURE_CONTAINER_REGISTRY_NAME }}.azurecr.io
# username: ${{ secrets.AZURE_CONTAINER_REGISTRY_USERNAME }}
# password: ${{ secrets.AZURE_CONTAINER_REGISTRY_PASSWORD }}
# # Build the build
# - name: Build the Docker image
# run: |
# docker build -t ${{ secrets.AZURE_CONTAINER_REGISTRY_NAME }}.azurecr.io/survey-backend:latest .
# # Push the Docker image to ACR
# - name: Push the Docker image
# run: |
# docker push ${{ secrets.AZURE_CONTAINER_REGISTRY_NAME }}.azurecr.io/survey-backend:latest