Files
Armen Zambrano G 843e82b6a9 feat: Publish Docker image to Github Registry instead of Docker Hub (#92)
The overall changes in here are:

- Upload a [Docker image](https://github.com/orgs/getsentry/packages/container/package/action-release-image) to Github's registry
- Make this action use the Github registry image instead of the Docker Hub one

Fixes API-2791
2022-07-18 13:26:44 -04:00

42 lines
1.5 KiB
YAML

name: "build"
on:
push:
branches:
- master
jobs:
docker-build:
name: Build & pubish Docker images
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
# BUILDKIT_INLINE_CACHE creates the image in such a way that you can
# then use --cache-from (think of a remote cache)
# This feature is allowed thanks to using the buildx plugin
#
# There's a COPY command in the builder stage that can easily invalidate the cache
# If you notice, please add more exceptions to .dockerignore since we loose the value
# of using --cache-from on the app stage
- name: Build Docker builder image
run: |
docker buildx build . \
--build-arg BUILDKIT_INLINE_CACHE=1 \
-t ghcr.io/getsentry/action-release-builder-image:latest \
--cache-from ghcr.io/getsentry/action-release-builder-image:latest \
--target builder
- name: Build Docker image
run: |
docker buildx build . \
--build-arg BUILDKIT_INLINE_CACHE=1 \
-t ghcr.io/getsentry/action-release-image:latest \
--cache-from ghcr.io/getsentry/action-release-image:latest \
--target app
- name: Login and publish
run: |
docker login ghcr.io -u $GITHUB_ACTOR --password-stdin <<< ${{ secrets.GITHUB_TOKEN }}
docker push ghcr.io/getsentry/action-release-builder-image:latest
docker push ghcr.io/getsentry/action-release-image:latest