Skip to content

Commit edf5d70

Browse files
committed
Add Docker build and push steps to dotnet-deployment.yml
1 parent 36f5d32 commit edf5d70

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/dotnet-deployment.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ on:
1111
branches: ["main"]
1212
paths: src/Application/**
1313

14+
env:
15+
registryName: kqrfo3r42nm3umpnpreg.azurecr.io
16+
repositoryName: techexcel/dotnetcoreapp
17+
dockerFolderPath: ./src/Application/src/RazorPagesTestSample
18+
tag: ${{ github.run_number }}
19+
1420
jobs:
1521
build:
1622
runs-on: ubuntu-latest
@@ -27,3 +33,30 @@ jobs:
2733
run: dotnet build --no-restore src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
2834
- name: Test
2935
run: dotnet test --no-build --verbosity normal src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj
36+
37+
dockerBuildPush:
38+
runs-on: ubuntu-latest
39+
needs: build
40+
41+
steps:
42+
- uses: actions/checkout@v3
43+
44+
- name: Docker Login
45+
# You may pin to the exact commit or the version.
46+
# uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
47+
uses: docker/[email protected]
48+
with:
49+
# Server address of Docker registry. If not set then will default to Docker Hub
50+
registry: ${{ secrets.ACR_LOGIN_SERVER }}
51+
# Username used to log against the Docker registry
52+
username: ${{ secrets.ACR_USERNAME }}
53+
# Password or personal access token used to log against the Docker registry
54+
password: ${{ secrets.ACR_PASSWORD }}
55+
# Log out from the Docker registry at the end of a job
56+
logout: true
57+
58+
- name: Docker Build
59+
run: docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath
60+
61+
- name: Docker Push
62+
run: docker push $registryName/$repositoryName:$tag

0 commit comments

Comments
 (0)