-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add initial GitHub action for building and pushing Docker images
Signed-off-by: Peter Stadler <[email protected]>
- Loading branch information
1 parent
71fdf99
commit 4e1db70
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Docker | ||
|
||
on: | ||
# run on every push to any branch | ||
push: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log in to GitHub registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: TEITechnicalCouncil | ||
password: ${{ secrets.TEITECHNICALCOUNCIL_PACKAGES_TOKEN }} | ||
|
||
# Login against DockerHub registry except on PR | ||
- name: Log in to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.PETERS_DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.PETERS_DOCKERHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/teic/romajs | ||
teic/romajs | ||
flavor: | | ||
latest=${{ github.ref == 'refs/heads/main' }} | ||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
platforms: | | ||
linux/amd64 | ||
linux/arm64/v8 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |