Skip to content

Build Docker image #232

Build Docker image

Build Docker image #232

Workflow file for this run

name: 'Build Docker image'
on:
push:
branches: [ "master" ]
paths:
- '**.cs'
- '**.csproj'
workflow_dispatch:
env:
TZ: America/Chicago
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# Cancel in-progress runs.
concurrency:
group: "docker-build"
cancel-in-progress: true
jobs:
docker_build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
#
# Pre-build to catch any initial errors
- name: Build
run: |
dotnet publish \
--configuration Release \
-r linux-x64 \
-o built
#
#
- name: docker login
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
#
- name: docker build
run: |
docker build \
-t gh-action-plot \
--label "org.opencontainers.image.source=https://github.com/erichiller/gh-action-plot/" \
--label "org.opencontainers.image.description=Program image" \
--label "org.opencontainers.image.licenses=MIT" \
.
- name: list images
run: docker images
- name: Tag image
run: |
docker tag gh-action-plot ghcr.io/erichiller/gh-action-plot:latest
#
- name: Push docker image
run: |
docker push ghcr.io/erichiller/gh-action-plot:latest