Skip to content

Commit 3e493e9

Browse files
authored
feat: add github actions and dockerfile (#16)
1 parent e6baf16 commit 3e493e9

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

.github/workflows/build.yaml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
build-and-push-image:
9+
name: Build and Push Docker images
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
19+
- uses: dorny/paths-filter@v3
20+
id: changes
21+
with:
22+
filters: |
23+
dockerfile:
24+
- 'Dockerfile'
25+
26+
- if: steps.changes.outputs.dockerfile == 'true'
27+
name: Set up QEMU
28+
uses: docker/setup-qemu-action@v2
29+
30+
- if: steps.changes.outputs.dockerfile == 'true'
31+
name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v2
33+
34+
- if: steps.changes.outputs.dockerfile == 'true'
35+
name: Login to GitHub Container Registry
36+
uses: docker/login-action@v2
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.repository_owner }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
# GHCR requires lowercase.
43+
- if: steps.changes.outputs.dockerfile == 'true'
44+
id: repo-lower
45+
uses: ASzc/change-string-case-action@v5
46+
with:
47+
string: ${{ github.repository }}
48+
49+
- if: steps.changes.outputs.dockerfile == 'true'
50+
uses: benjlevesque/[email protected]
51+
id: short-sha
52+
with:
53+
length: 7
54+
55+
- if: steps.changes.outputs.dockerfile == 'true'
56+
name: Build and push
57+
uses: docker/build-push-action@v4
58+
with:
59+
push: true
60+
platforms: linux/amd64,linux/arm64
61+
tags: ghcr.io/${{ steps.repo-lower.outputs.lowercase }}:${{ steps.short-sha.outputs.sha }}, ghcr.io/${{ steps.repo-lower.outputs.lowercase }}:latest

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM quay.io/akuity/argo-cd-learning-assets/guestbook:latest

0 commit comments

Comments
 (0)