Skip to content

Commit

Permalink
feat: add github actions and dockerfile (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
morey-tech committed Jul 23, 2024
1 parent e6baf16 commit 3e493e9
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build
on:
push:
branches:
- main

jobs:
build-and-push-image:
name: Build and Push Docker images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3

- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
dockerfile:
- 'Dockerfile'
- if: steps.changes.outputs.dockerfile == 'true'
name: Set up QEMU
uses: docker/setup-qemu-action@v2

- if: steps.changes.outputs.dockerfile == 'true'
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- if: steps.changes.outputs.dockerfile == 'true'
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

# GHCR requires lowercase.
- if: steps.changes.outputs.dockerfile == 'true'
id: repo-lower
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.repository }}

- if: steps.changes.outputs.dockerfile == 'true'
uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7

- if: steps.changes.outputs.dockerfile == 'true'
name: Build and push
uses: docker/build-push-action@v4
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ steps.repo-lower.outputs.lowercase }}:${{ steps.short-sha.outputs.sha }}, ghcr.io/${{ steps.repo-lower.outputs.lowercase }}:latest
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM quay.io/akuity/argo-cd-learning-assets/guestbook:latest

0 comments on commit 3e493e9

Please sign in to comment.