Skip to content

Commit

Permalink
feat: using GHCR as the new registry (#4)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jlong49 and sxd authored Aug 4, 2022
1 parent 4b30e42 commit 07ab49c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,55 @@ on:
branches: [ main ]
tags: [ '*' ]
workflow_dispatch:

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

jobs:
build:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout source code
uses: actions/[email protected]

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

- name: Image metadata
id: metadata
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}
- name: Set up QEMU
uses: docker/[email protected]
with:
image: tonistiigi/binfmt:qemu-v6.1.0
image: tonistiigi/binfmt:qemu-v6.2.0
platforms: "linux/amd64,linux/arm64,linux/ppc64le,linux/s390x"

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/[email protected]

- name: Login to registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3.0.0
uses: docker/build-push-action@v3.1.0
with:
context: .
platforms: "linux/amd64,linux/arm64,linux/ppc64le,linux/s390x"
tags: ${{ steps.get_version.outputs.VERSION }}
push: true
tags: ${{ steps.metadata.outputs.tags }}
push: true
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ WORKDIR /app
RUN make

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

0 comments on commit 07ab49c

Please sign in to comment.