Build Container #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Container | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- '.github/**' | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
paths: | |
- 'src/**' | |
- '.github/**' | |
workflow_dispatch: | |
jobs: | |
build-and-push-application: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dotnet-version: ['8.0.x'] | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: '0' | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet-version }} | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: 5.x | |
- id: determine_version | |
name: Determine Version | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
additionalArguments: /overrideconfig mode=Mainline | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_PAT_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PAT }} | |
- name: install buildx | |
id: buildx | |
uses: crazy-max/ghaction-docker-buildx@v1 | |
with: | |
version: latest | |
- name: build and push website container | |
working-directory: src | |
run: | | |
docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7 -f "./RandomQuotes.Web/Dockerfile" --tag octopussamples/randomquotes-k8s:${{ steps.determine_version.outputs.semVer }} --tag octopussamples/randomquotes-k8s:latest . |