Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Publish Docker image (Without Tag Released) #7

Publish Docker image (Without Tag Released)

Publish Docker image (Without Tag Released) #7

#################################################
# Author : @H0llyW00dzZ #
# Note : This Using Github Container #
# Which Pretty useful for GitHub pro plans #
#################################################
name: Publish Docker image (Without Tag Released)
on:
workflow_dispatch:
inputs:
tag_version:
description: 'Enter the tag version for the Docker image'
required: true
description:
description: 'Enter the description for the Docker image'
required: true
build_reverse_proxy:
description: 'Build Go reverse proxy? (yes/no)'
default: 'no'
required: true
go_reverse_proxy_tag:
description: 'Enter the tag for the go-reverse-proxy repository (optional)'
required: false
release:
types: [published]
jobs:
push_to_registry:
name: Push Docker image to GitHub Container Registry
runs-on: ubuntu-latest
steps:
- # This CI / CD Docker Builder with multi-repo
name: Check out ChatGPT-Next-Web repo
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/ChatGPT-Next-Web
ref: main
path: ChatGPT-Next-Web
-
name: Check out go-reverse-proxy repo
if: ${{ github.event.inputs.build_reverse_proxy == 'yes' }}
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/go-reverse-proxy
ref: master
path: go-reverse-proxy
-
name: Set up Go
if: ${{ github.event.inputs.build_reverse_proxy == 'yes' }}
uses: actions/setup-go@v4
with:
go-version: '1.21.3'
env:
NODE_VERSION: 18
-
name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: yidadaa/chatgpt-next-web
tags: |
type=raw,value=latest
type=ref,event=tag
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build and push Docker image with reverse proxy
if: ${{ github.event.inputs.build_reverse_proxy == 'yes' }}
run: |
docker buildx create --use
docker buildx build -t ghcr.io/h0llyw00dzz/chatgpt-next-web:${{ github.event.inputs.tag_version }} \
--build-arg BUILD_REVERSE_PROXY=${{ github.event.inputs.build_reverse_proxy == 'yes' }} \
--build-arg GO_REVERSE_PROXY_TAG=${{ github.event.inputs.go_reverse_proxy_tag }} \
--label "version=${{ github.event.inputs.tag_version }}" \
--label "description=${{ github.event.inputs.description }}" \
--cache-from type=gha \
--cache-to type=gha,mode=max \
--platform linux/amd64,linux/arm64 \
-f ./ChatGPT-Next-Web/Dockerfile \
./ChatGPT-Next-Web \
-f ./go-reverse-proxy/Dockerfile \
./go-reverse-proxy
docker push ghcr.io/h0llyw00dzz/chatgpt-next-web:${{ github.event.inputs.tag_version }}
-
name: Build and push Docker image without reverse proxy
if: ${{ github.event.inputs.build_reverse_proxy == 'no' }}
run: |
docker buildx create --use
docker buildx build -t ghcr.io/h0llyw00dzz/chatgpt-next-web:${{ github.event.inputs.tag_version }} \
--label "version=${{ github.event.inputs.tag_version }}" \
--label "description=${{ github.event.inputs.description }}" \
--cache-from type=gha \
--cache-to type=gha,mode=max \
--platform linux/amd64,linux/arm64 \
./ChatGPT-Next-Web
docker push ghcr.io/h0llyw00dzz/chatgpt-next-web:${{ github.event.inputs.tag_version }}