Skip to content

Commit 07ab49c

Browse files
jlong49sxd
andauthored
feat: using GHCR as the new registry (#4)
This patch implements the use of ghcr.io as the new container registry for the project. Signed-off-by: Jonathan Gonzalez V <[email protected]> Co-authored-by: Jonathan Gonzalez V <[email protected]>
1 parent 4b30e42 commit 07ab49c

File tree

2 files changed

+32
-10
lines changed

2 files changed

+32
-10
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,55 @@ on:
55
branches: [ main ]
66
tags: [ '*' ]
77
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }},
12+
813
jobs:
914
build:
15+
permissions:
16+
contents: read
17+
packages: write
1018
runs-on: ubuntu-latest
1119
steps:
12-
- uses: actions/checkout@v2
20+
- name: Checkout source code
21+
uses: actions/[email protected]
1322

1423
- name: Get the reference
1524
id: get_version
1625
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
1726

27+
- name: Image metadata
28+
id: metadata
29+
uses: docker/[email protected]
30+
with:
31+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
32+
tags: |
33+
type=ref,event=branch
34+
type=ref,event=pr
35+
type=semver,pattern={{version}
36+
1837
- name: Set up QEMU
1938
uses: docker/[email protected]
2039
with:
21-
image: tonistiigi/binfmt:qemu-v6.1.0
40+
image: tonistiigi/binfmt:qemu-v6.2.0
2241
platforms: "linux/amd64,linux/arm64,linux/ppc64le,linux/s390x"
2342

2443
- name: Set up Docker Buildx
2544
id: buildx
26-
uses: docker/setup-buildx-action@v1
45+
uses: docker/[email protected]
46+
2747
- name: Login to registry
28-
uses: docker/login-action@v1
48+
uses: docker/login-action@v2
2949
with:
30-
registry: quay.io
31-
username: ${{ secrets.DOCKER_USERNAME }}
32-
password: ${{ secrets.DOCKER_PASSWORD }}
50+
registry: ${{ env.REGISTRY }}
51+
username: ${{ github.repository_owner }}
52+
password: ${{ secrets.GITHUB_TOKEN }}
3353
- name: Build and push
34-
uses: docker/build-push-action@v3.0.0
54+
uses: docker/build-push-action@v3.1.0
3555
with:
56+
context: .
3657
platforms: "linux/amd64,linux/arm64,linux/ppc64le,linux/s390x"
37-
tags: ${{ steps.get_version.outputs.VERSION }}
38-
push: true
58+
tags: ${{ steps.metadata.outputs.tags }}
59+
push: true

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ WORKDIR /app
55
RUN make
66

77
FROM ubuntu:bionic
8+
LABEL quay.expires-after=1d
89
RUN apt-get -y update && apt-get install -y postgresql-client && rm -rf /var/lib/apt/lists/*
910
COPY --from=builder /app/http_test /app/http_test
1011
CMD ["/app/http_test"]

0 commit comments

Comments
 (0)