Skip to content

Commit

Permalink
Merge pull request #1 from dlcs/feature/initialBuild
Browse files Browse the repository at this point in the history
Feature/initial build
  • Loading branch information
JackLewis-digirati authored Jul 12, 2023
2 parents 0529df2 + ba1bb5d commit a09de66
Show file tree
Hide file tree
Showing 39 changed files with 1,925 additions and 531 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
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
Loading

0 comments on commit a09de66

Please sign in to comment.