Skip to content

add custom check (#16) #25

add custom check (#16)

add custom check (#16) #25

name: Custom Base Image Example
on:
push:
workflow_dispatch:
env:
GITHUB_USERNAME: baronfel
BASE_IMAGE: "ghcr.io/baronfel/dotnet-runtime-skia-base-image:8.0"
IMAGE_NAME: baronfel/skia-app
IMAGE_TAG: "8.0"
jobs:
create-base-image:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the code
uses: actions/checkout@v4
- name: Build the base image
working-directory: src/custom-base-image
run: |
docker build -t ${{ env.BASE_IMAGE }} -f Dockerfile .
docker push ${{ env.BASE_IMAGE }}
use-base-image:
needs: create-base-image
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get .NET
uses: actions/setup-dotnet@v4
- name: Get the code
uses: actions/checkout@v4
- name: Build and publish the app
working-directory: src/custom-base-image
run: |
dotnet publish -t:PublishContainer \
-p ContainerBaseImage="${{ env.BASE_IMAGE }}" \
-p ContainerRepository="${{ env.IMAGE_NAME}}" \
-p ContainerImageTag="${{ env.IMAGE_TAG }}" \
-p ContainerRegistry=ghcr.io
run-the-image:
needs: use-base-image
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Execute the container
run: |
docker run --pull missing --rm ghcr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}