Skip to content

Commit

Permalink
Merge pull request #435 from Kegbot/mikey/ghcr
Browse files Browse the repository at this point in the history
docker: switch releases to ghcr.io
  • Loading branch information
mik3y authored Jul 24, 2022
2 parents c6b54ee + b3fd35f commit 2067adf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.github/
build/
*.egg-info
docs/build/
docs/
dist/
kegbot-data/
staticfiles/
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Docker Build

env:
IMAGE_NAME: kegbot/server
REGISTRY: ghcr.io

on:
push:
Expand Down Expand Up @@ -33,7 +34,6 @@ jobs:
else
echo ::set-output name=version::snapshot
fi
echo ::set-output name=build_archs::linux/amd64
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
# Work around an armv7 -> qemu bug caused during rust compilation. Yeah.. See repo.
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=dev
type=raw,value=latest,enable={{is_default_branch}}
Expand All @@ -83,6 +83,7 @@ jobs:
cache-to: type=gha,mode=max
push: false
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_DATE=${{ steps.prepare.outputs.build_date }}
GIT_SHORT_SHA=${GITHUB_SHA::8}
Expand All @@ -92,20 +93,24 @@ jobs:
linux/arm64
linux/arm/v7
-
name: Login to registry
if: ${{ '${{ secrets.DOCKER_HUB_PASSWORD }}' != '' && '${{ secrets.DOCKER_HUB_USERNAME }}' != '' }}
run: echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
- name: Log in to container registry
if: ${{ '${{ secrets.GITHUB_TOKEN }}' != '' }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push to registry
if: ${{ '${{ secrets.DOCKER_HUB_PASSWORD }}' != '' && '${{ secrets.DOCKER_HUB_USERNAME }}' != '' }}
- name: Build and push to container registry
if: ${{ '${{ secrets.GITHUB_TOKEN }}' != '' }}
uses: docker/build-push-action@v3
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_DATE=${{ steps.prepare.outputs.build_date }}
GIT_SHORT_SHA=${GITHUB_SHA::8}
Expand Down
4 changes: 2 additions & 2 deletions docs/source/docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
kegbot:
image: kegbot/server:stable
image: ghcr.io/kegbot/server:stable
restart: unless-stopped
command: run_server
ports:
Expand All @@ -19,7 +19,7 @@ services:
KEGBOT_SECRET_KEY: "changeme"

workers:
image: kegbot/server:stable
image: ghcr.io/kegbot/server:stable
restart: unless-stopped
command: run_workers
volumes:
Expand Down

0 comments on commit 2067adf

Please sign in to comment.