Skip to content

Commit

Permalink
Add GitHub workflow to publish Docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Sep 5, 2024
1 parent fcc8b68 commit a83982c
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish Docker
on:
push:
branches:
- main
- dev
tags:
- v*
paths-ignore:
- '**.md'
- '.github/**'
- jsconfig.json
- .gitignore
- '.eslint**'

# Adapted from:
# - https://github.com/docker/metadata-action#semver
# - https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
publish:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Docker Meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and Push
uses: docker/build-push-action@v4
with:
context: .
file: .docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit a83982c

Please sign in to comment.