Add Forgejo CI workflow to build and push Docker image
Some checks failed
Build & Push Docker Image / build (push) Failing after 3m19s
Some checks failed
Build & Push Docker Image / build (push) Failing after 3m19s
This commit is contained in:
parent
e0f9fe6842
commit
376c5a9bed
1 changed files with 58 additions and 0 deletions
58
.forgejo/workflows/docker-build.yml
Normal file
58
.forgejo/workflows/docker-build.yml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
name: Build & Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
api_url:
|
||||
description: 'API URL for frontend build'
|
||||
required: false
|
||||
default: 'http://ut.khoavo.myds.me:8981/api'
|
||||
type: string
|
||||
|
||||
env:
|
||||
REGISTRY: git.khoavo.myds.me
|
||||
IMAGE: git.khoavo.myds.me/vndangkhoa/kv-tube
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log into Forgejo Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.FORGEJO_USERNAME }}
|
||||
password: ${{ secrets.FORGEJO_PASSWORD }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.IMAGE }}
|
||||
tags: |
|
||||
type=sha,prefix=
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/tags/v*' }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
build-args: |
|
||||
NEXT_PUBLIC_API_URL=${{ github.event.inputs.api_url || 'http://ut.khoavo.myds.me:8981/api' }}
|
||||
Loading…
Reference in a new issue