fix: separate GHCR and Docker Hub builds

This commit is contained in:
alam00000
2026-01-27 19:19:28 +05:30
parent 9c57adf634
commit 25687fa049
2 changed files with 26 additions and 33 deletions

View File

@@ -73,12 +73,6 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
@@ -109,7 +103,6 @@ jobs:
build-args: | build-args: |
SIMPLE_MODE=${{ matrix.mode.simple_mode }} SIMPLE_MODE=${{ matrix.mode.simple_mode }}
tags: | tags: |
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64
ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64
platforms: linux/amd64 platforms: linux/amd64
cache-from: type=gha,scope=amd64-${{ matrix.mode.name }} cache-from: type=gha,scope=amd64-${{ matrix.mode.name }}
@@ -123,7 +116,6 @@ jobs:
build-args: | build-args: |
SIMPLE_MODE=${{ matrix.mode.simple_mode }} SIMPLE_MODE=${{ matrix.mode.simple_mode }}
tags: | tags: |
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:edge-amd64
ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-amd64 ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-amd64
platforms: linux/amd64 platforms: linux/amd64
cache-from: type=gha,scope=amd64-${{ matrix.mode.name }} cache-from: type=gha,scope=amd64-${{ matrix.mode.name }}
@@ -150,12 +142,6 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
@@ -186,7 +172,6 @@ jobs:
build-args: | build-args: |
SIMPLE_MODE=${{ matrix.mode.simple_mode }} SIMPLE_MODE=${{ matrix.mode.simple_mode }}
tags: | tags: |
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64 ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
platforms: linux/arm64 platforms: linux/arm64
cache-from: type=gha,scope=arm64-${{ matrix.mode.name }} cache-from: type=gha,scope=arm64-${{ matrix.mode.name }}
@@ -200,7 +185,6 @@ jobs:
build-args: | build-args: |
SIMPLE_MODE=${{ matrix.mode.simple_mode }} SIMPLE_MODE=${{ matrix.mode.simple_mode }}
tags: | tags: |
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:edge-arm64
ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-arm64 ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-arm64
platforms: linux/arm64 platforms: linux/arm64
cache-from: type=gha,scope=arm64-${{ matrix.mode.name }} cache-from: type=gha,scope=arm64-${{ matrix.mode.name }}
@@ -268,12 +252,14 @@ jobs:
ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-amd64 \ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-amd64 \
ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-arm64 ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-arm64
# Merge DockerHub manifests (separate job, can fail independently) # Copy images from GHCR to DockerHub
merge-manifests-dockerhub: push-to-dockerhub:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build-amd64, build-arm64] needs: [merge-manifests-ghcr]
continue-on-error: true
permissions: permissions:
contents: read contents: read
packages: read
strategy: strategy:
matrix: matrix:
mode: mode:
@@ -282,6 +268,13 @@ jobs:
- name: simple - name: simple
suffix: "-simple" suffix: "-simple"
steps: steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
@@ -303,28 +296,28 @@ jobs:
echo "is_release=false" >> $GITHUB_OUTPUT echo "is_release=false" >> $GITHUB_OUTPUT
fi fi
- name: Create and push DockerHub manifest (release) - name: Copy images to DockerHub (release)
if: steps.version.outputs.is_release == 'true' if: steps.version.outputs.is_release == 'true'
run: | run: |
docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:latest \ docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:latest \
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64 ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }} \ docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }} \
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64 ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version_without_v }} \ docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version_without_v }} \
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64 ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
- name: Create and push DockerHub manifest (edge) - name: Copy images to DockerHub (edge)
if: steps.version.outputs.is_release == 'false' if: steps.version.outputs.is_release == 'false'
run: | run: |
docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:edge \ docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:edge \
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:edge-amd64 \ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-amd64 \
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:edge-arm64 ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-arm64
docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:sha-${{ steps.version.outputs.short_sha }} \ docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:sha-${{ steps.version.outputs.short_sha }} \
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:edge-amd64 \ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-amd64 \
bentopdfteam/bentopdf${{ matrix.mode.suffix }}:edge-arm64 ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-arm64

View File

@@ -3,7 +3,7 @@
ARG BASE_URL= ARG BASE_URL=
# Build stage # Build stage
FROM node:20-alpine AS builder FROM public.ecr.aws/docker/library/node:20-alpine AS builder
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
COPY vendor ./vendor COPY vendor ./vendor
@@ -31,7 +31,7 @@ ENV NODE_OPTIONS="--max-old-space-size=3072"
RUN npm run build:with-docs RUN npm run build:with-docs
# Production stage # Production stage
FROM nginxinc/nginx-unprivileged:stable-alpine-slim FROM quay.io/nginx/nginx-unprivileged:stable-alpine-slim
LABEL org.opencontainers.image.source="https://github.com/alam00000/bentopdf" LABEL org.opencontainers.image.source="https://github.com/alam00000/bentopdf"
LABEL org.opencontainers.image.url="https://github.com/alam00000/bentopdf" LABEL org.opencontainers.image.url="https://github.com/alam00000/bentopdf"