Skip to content

Commit

Permalink
ci(debug): debug docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
vponomaryov committed Feb 7, 2025
1 parent 926784d commit 3ec61c9
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 32 deletions.
100 changes: 74 additions & 26 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ on:
required: false
type: string
secrets:
DOCKERHUB_TOKEN:
DOCKERHUB_TOKEN_VP:
required: true
DOCKERHUB_USERNAME:
DOCKERHUB_USERNAME_VP:
required: true

workflow_dispatch:
inputs:
version:
Expand All @@ -21,37 +20,86 @@ on:
type: string

jobs:
docker:
runs-on: ubuntu-24.04
build-with-matrix:
name: Build ${{ matrix.build.platform }}
runs-on: ubuntu-24.04${{ matrix.build.platform == 'linux/arm64/v8' && '-arm' || '' }}
strategy:
matrix:
# platform:
# - linux/amd64
# - linux/arm64/v8
build:
- platform: linux/amd64
cache: cache-amd64
- platform: linux/arm64/v8
cache: cache-arm64
steps:
- name: Checkout
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

# Needed for ARM64 Docker builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME_VP }}
password: ${{ secrets.DOCKERHUB_TOKEN_VP }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to dockerhub
uses: docker/login-action@v3
- name: Enable BuildKit
run: echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV

- name: Build and Cache Image for the ${{ matrix.build.platform }} platform
run: |
docker buildx build \
--cache-from=type=registry,ref=vponomarovatscylladb/hydra-loaders:${{ matrix.build.cache }} \
--cache-to=type=registry,ref=vponomarovatscylladb/hydra-loaders:${{ matrix.build.cache }} \
--platform ${{ matrix.build.platform }} \
--load .
push-after-matrix:
name: Push multiarch images
needs: build-with-matrix
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push API
uses: docker/build-push-action@v6
fetch-depth: 0
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
file: ./Dockerfile
context: .
push: true
pull: true
platforms: "linux/amd64,linux/arm64/v8"
target: production
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
scylladb/latte:latest
scylladb/latte:${{ inputs.version }}
username: ${{ secrets.DOCKERHUB_USERNAME_VP }}
password: ${{ secrets.DOCKERHUB_TOKEN_VP }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Enable BuildKit
run: echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV

- name: Create Multi-Arch Manifest and Push
run: |
docker buildx build \
--cache-from=type=registry,ref=vponomarovatscylladb/hydra-loaders:cache-amd64 \
--cache-from=type=registry,ref=vponomarovatscylladb/hydra-loaders:cache-arm64 \
--platform linux/amd64,linux/arm64/v8 \
--output=type=image \
-t vponomarovatscylladb/hydra-loaders:latte-latest \
--push .
docker buildx build \
--cache-from=type=registry,ref=vponomarovatscylladb/hydra-loaders:cache-amd64 \
--cache-from=type=registry,ref=vponomarovatscylladb/hydra-loaders:cache-arm64 \
--platform linux/amd64,linux/arm64/v8 \
--output=type=image \
-t vponomarovatscylladb/hydra-loaders:latte-${{ inputs.version }} \
--push .
# docker buildx imagetools create \
# --tag vponomarovatscylladb/hydra-loaders:latte-latest \
# vponomarovatscylladb/hydra-loaders:latte-linux/amd64 \
# vponomarovatscylladb/hydra-loaders:latte-linux/arm64/v8
# docker buildx imagetools create \
# --tag vponomarovatscylladb/hydra-loaders:latte-${{ inputs.version }} \
# vponomarovatscylladb/hydra-loaders:latte-linux/amd64 \
# vponomarovatscylladb/hydra-loaders:latte-linux/arm64/v8
6 changes: 3 additions & 3 deletions .github/workflows/dockerhub-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: scylladb/latte
username: ${{ secrets.DOCKERHUB_USERNAME_VP }}
password: ${{ secrets.DOCKERHUB_TOKEN_VP }}
repository: vponomarovatscylladb/hydra-loaders
short-description: ${{ github.event.repository.description }}
enable-url-completion: true
10 changes: 7 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ on:
push:
tags:
- '*'
branches:
- debug

jobs:
get_tag:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version_tag.outputs.tag }}
# tag: ${{ steps.version_tag.outputs.tag }}
tag: "debug"
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -25,8 +29,8 @@ jobs:
with:
version: ${{ needs.get_tag.outputs.tag }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DOCKERHUB_USERNAME_VP: ${{ secrets.DOCKERHUB_USERNAME_VP }}
DOCKERHUB_TOKEN_VP: ${{ secrets.DOCKERHUB_TOKEN_VP }}

release:
needs: [get_tag, docker_build]
Expand Down

0 comments on commit 3ec61c9

Please sign in to comment.