-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (25 loc) · 1.06 KB
/
publish-api-image.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Build and Push Docker image to Azure Container Registry
on:
push:
# Uncomment this if you want to limit it to specific branches
# branches:
# - main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code from the repository
- name: Checkout code
uses: actions/checkout@v2
# Step 2: Set up Docker Buildx (optional, improves build performance)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# Step 3: Log in to Azure Container Registry
- name: Log in to Azure Container Registry
run: echo "${{ secrets.ACR_PASSWORD }}" | docker login "${{ secrets.ACR_SERVER }}" -u "${{ secrets.ACR_USERNAME }}" --password-stdin
# Step 4: Build the Docker image
- name: Build the Docker image
run: docker build -t "${{ secrets.ACR_SERVER }}/aquaapi:latest" ./api/AquaApi
# Step 5: Push the Docker image to Azure Container Registry
- name: Push the Docker image
run: docker push "${{ secrets.ACR_SERVER }}/aquaapi:latest"