Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Docker/publish to ghcr #172

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/release_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ jobs:
- uses: ruby/setup-ruby@v1
- run: "bundle install"

- name: Log into ghcr registry
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Release image
run: script/release-workflow/run.sh
env:
Expand Down
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,14 @@ If you want to run the container as a standalone instance, then the `dius/pact-b

## Platforms

### Single platform images

By default, vanilla tags, are built only for `amd64`

- `--platform=linux/amd64`

```sh
docker run --rm -it --entrypoint /bin/sh pactfoundation/pact-broker:latest -c 'uname -sm'
```

### Multi-manifest image

Multi-platform images are available, by appending `-multi` to any release tag
Multi-platform images are available

- `--platform=linux/amd64`
- `--platform=linux/arm/v7`
- `--platform=linux/arm64`

```sh
docker run --rm -it --entrypoint /bin/sh pactfoundation/pact-broker:latest-multi -c 'uname -sm'
docker run --rm -it --entrypoint /bin/sh pactfoundation/pact-broker:latest -c 'uname -sm'
```

## Prerequisites
Expand Down
22 changes: 11 additions & 11 deletions script/release-workflow/docker-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@

set -euo >/dev/null

## Publish a multi arch build with -multi added to the tag
## ($TAG||$MAJOR_TAG||$LATEST)-multi
push_multi() {
## Publish a multi arch build
## ($TAG||$MAJOR_TAG||$LATEST)
push() {
## These will use cached builds, so wont build every time.
docker buildx build --platform=linux/amd64,linux/arm64,linux/arm \
--output=type=image,push=true \
-t ${DOCKER_IMAGE_ORG_AND_NAME}:$1-multi .
}
push() {
docker buildx build --platform=linux/amd64 \
--output=type=image,push=true \
-t ${DOCKER_IMAGE_ORG_AND_NAME}:$1 .
}
push_ghcr() {
docker buildx build --platform=linux/amd64,linux/arm64,linux/arm \
--output=type=image,push=true \
-t ghcr.io/${DOCKER_IMAGE_ORG_AND_NAME}:$1
}

if [ -n "${MAJOR_TAG:-}" ]; then
push ${MAJOR_TAG}
push_multi ${MAJOR_TAG}
push_ghcr ${MAJOR_TAG}
fi

push ${TAG}
push_multi ${TAG}
push_ghcr ${TAG}

if [ "${PUSH_TO_LATEST}" != "false" ]; then
push latest
push_multi latest
push_ghcr latest
fi
Loading