Skip to content

Feature/initial build #3

Feature/initial build

Feature/initial build #3

Workflow file for this run

name: Build and push docker images
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
jobs:
build-push:
runs-on: ubuntu-latest
steps:
- id: checkout
uses: actions/checkout@v3
- id: setup-dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
- id: dotnet-test
run: dotnet test ./src /p:Configuration=Release --verbosity normal
- id: buildx
uses: docker/setup-buildx-action@v2
- id: docker-meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/dlcs/request-logger
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha,format=long
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- id: docker-cache
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- id: ghcr-login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: docker_build
uses: docker/build-push-action@v4
with:
context: ./src
file: src/RequestLogger/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
push: true
build-push-nginx:
runs-on: ubuntu-latest
steps:
- id: checkout
uses: actions/checkout@v3
- id: buildx
uses: docker/setup-buildx-action@v2
- id: docker-meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/dlcs/request-logger-nginx
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha,format=long
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- id: docker-cache
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- id: ghcr-login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: docker_build
uses: docker/build-push-action@v4
with:
context: ./nginx
file: nginx/nginx.Dockerfile
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
push: true