Rename docker-image.yml to docker.yml
This commit is contained in:
94
.github/workflows/docker-image.yml
vendored
94
.github/workflows/docker-image.yml
vendored
@@ -1,94 +0,0 @@
|
|||||||
name: Build and Push Docker Image
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: "Version to build (e.g., 1.8.0)"
|
|
||||||
required: true
|
|
||||||
production:
|
|
||||||
description: "Is this a production build?"
|
|
||||||
required: true
|
|
||||||
default: false
|
|
||||||
type: boolean
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
with:
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Determine tags
|
|
||||||
id: tags
|
|
||||||
run: |
|
|
||||||
VERSION=${{ github.event.inputs.version }}
|
|
||||||
PROD=${{ github.event.inputs.production }}
|
|
||||||
|
|
||||||
TAGS=()
|
|
||||||
ALL_TAGS=()
|
|
||||||
|
|
||||||
if [ "$PROD" = "true" ]; then
|
|
||||||
# Production build → push release + latest to both GHCR and Docker Hub
|
|
||||||
TAGS+=("release-$VERSION" "latest")
|
|
||||||
for tag in "${TAGS[@]}"; do
|
|
||||||
ALL_TAGS+=("ghcr.io/lukegus/termix:$tag")
|
|
||||||
ALL_TAGS+=("docker.io/bugattiguy527/termix:$tag")
|
|
||||||
done
|
|
||||||
else
|
|
||||||
# Dev build → push only dev-x.x.x to GHCR
|
|
||||||
TAGS+=("dev-$VERSION")
|
|
||||||
for tag in "${TAGS[@]}"; do
|
|
||||||
ALL_TAGS+=("ghcr.io/lukegus/termix:$tag")
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "ALL_TAGS=${ALL_TAGS[*]}" >> $GITHUB_ENV
|
|
||||||
echo "All tags to build:"
|
|
||||||
printf '%s\n' "${ALL_TAGS[@]}"
|
|
||||||
|
|
||||||
- name: Login to GHCR
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: lukegus
|
|
||||||
password: ${{ secrets.GHCR_TOKEN }}
|
|
||||||
|
|
||||||
- name: Login to Docker Hub (prod only)
|
|
||||||
if: ${{ github.event.inputs.production == 'true' }}
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: bugattiguy527
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push multi-arch image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./docker/Dockerfile
|
|
||||||
push: true
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
tags: ${{ env.ALL_TAGS }}
|
|
||||||
build-args: |
|
|
||||||
BUILDKIT_INLINE_CACHE=1
|
|
||||||
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
|
|
||||||
labels: |
|
|
||||||
org.opencontainers.image.source=https://github.com/${{ github.repository }}
|
|
||||||
org.opencontainers.image.revision=${{ github.sha }}
|
|
||||||
outputs: type=registry,compression=zstd,compression-level=19
|
|
||||||
|
|
||||||
- name: Cleanup Docker
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
docker image prune -af
|
|
||||||
docker system prune -af --volumes
|
|
||||||
23
.github/workflows/docker.yml
vendored
23
.github/workflows/docker.yml
vendored
@@ -6,14 +6,11 @@ on:
|
|||||||
version:
|
version:
|
||||||
description: "Version to build (e.g., 1.8.0)"
|
description: "Version to build (e.g., 1.8.0)"
|
||||||
required: true
|
required: true
|
||||||
build_type:
|
production:
|
||||||
description: "Build type"
|
description: "Is this a production build?"
|
||||||
required: true
|
required: true
|
||||||
default: "Development"
|
default: false
|
||||||
type: choice
|
type: boolean
|
||||||
options:
|
|
||||||
- Development
|
|
||||||
- Production
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -36,25 +33,29 @@ jobs:
|
|||||||
id: tags
|
id: tags
|
||||||
run: |
|
run: |
|
||||||
VERSION=${{ github.event.inputs.version }}
|
VERSION=${{ github.event.inputs.version }}
|
||||||
BUILD_TYPE=${{ github.event.inputs.build_type }}
|
PROD=${{ github.event.inputs.production }}
|
||||||
|
|
||||||
TAGS=()
|
TAGS=()
|
||||||
ALL_TAGS=()
|
ALL_TAGS=()
|
||||||
|
|
||||||
if [ "$BUILD_TYPE" = "Production" ]; then
|
if [ "$PROD" = "true" ]; then
|
||||||
|
# Production build → push release + latest to both GHCR and Docker Hub
|
||||||
TAGS+=("release-$VERSION" "latest")
|
TAGS+=("release-$VERSION" "latest")
|
||||||
for tag in "${TAGS[@]}"; do
|
for tag in "${TAGS[@]}"; do
|
||||||
ALL_TAGS+=("ghcr.io/lukegus/termix:$tag")
|
ALL_TAGS+=("ghcr.io/lukegus/termix:$tag")
|
||||||
ALL_TAGS+=("docker.io/bugattiguy527/termix:$tag")
|
ALL_TAGS+=("docker.io/bugattiguy527/termix:$tag")
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
# Dev build → push only dev-x.x.x to GHCR
|
||||||
TAGS+=("dev-$VERSION")
|
TAGS+=("dev-$VERSION")
|
||||||
for tag in "${TAGS[@]}"; do
|
for tag in "${TAGS[@]}"; do
|
||||||
ALL_TAGS+=("ghcr.io/lukegus/termix:$tag")
|
ALL_TAGS+=("ghcr.io/lukegus/termix:$tag")
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "ALL_TAGS=$(printf '%s\n' "${ALL_TAGS[@]}")" >> $GITHUB_ENV
|
echo "ALL_TAGS=${ALL_TAGS[*]}" >> $GITHUB_ENV
|
||||||
|
echo "All tags to build:"
|
||||||
|
printf '%s\n' "${ALL_TAGS[@]}"
|
||||||
|
|
||||||
- name: Login to GHCR
|
- name: Login to GHCR
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
@@ -64,7 +65,7 @@ jobs:
|
|||||||
password: ${{ secrets.GHCR_TOKEN }}
|
password: ${{ secrets.GHCR_TOKEN }}
|
||||||
|
|
||||||
- name: Login to Docker Hub (prod only)
|
- name: Login to Docker Hub (prod only)
|
||||||
if: ${{ github.event.inputs.build_type == 'Production' }}
|
if: ${{ github.event.inputs.production == 'true' }}
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: bugattiguy527
|
username: bugattiguy527
|
||||||
|
|||||||
Reference in New Issue
Block a user