This commit is contained in:
parent
454ef227eb
commit
f5f356d695
2 changed files with 10 additions and 68 deletions
|
|
@ -1,68 +0,0 @@
|
|||
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
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker-build
|
||||
steps:
|
||||
- name: Install tools
|
||||
run: apk add --no-cache git docker-cli
|
||||
|
||||
- name: Docker info
|
||||
run: docker version && docker info
|
||||
|
||||
- name: Checkout
|
||||
run: |
|
||||
git clone https://vndangkhoa:Thieugia19@git.khoavo.myds.me/vndangkhoa/kv-tube.git /tmp/kv-tube
|
||||
cd /tmp/kv-tube
|
||||
git checkout ${GITHUB_SHA:-main}
|
||||
echo "Checked out: $(git rev-parse --short HEAD)"
|
||||
|
||||
- name: Login to registry
|
||||
run: |
|
||||
echo "Thieugia19" | docker login git.khoavo.myds.me -u vndangkhoa --password-stdin
|
||||
|
||||
- name: Build and push
|
||||
run: |
|
||||
cd /tmp/kv-tube
|
||||
SHA_SHORT=$(git rev-parse --short HEAD)
|
||||
IMAGE="git.khoavo.myds.me/vndangkhoa/kv-tube"
|
||||
TAGS="${IMAGE}:${SHA_SHORT}"
|
||||
if [ "${GITHUB_REF}" = "refs/heads/main" ] || [ "${GITHUB_REF}" = "refs/heads/master" ]; then
|
||||
TAGS="${TAGS},${IMAGE}:main"
|
||||
fi
|
||||
if echo "${GITHUB_REF}" | grep -q "refs/tags/v"; then
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
TAGS="${TAGS},${IMAGE}:${VERSION},${IMAGE}:latest"
|
||||
fi
|
||||
echo "Building tags: ${TAGS}"
|
||||
|
||||
TAG_ARGS=""
|
||||
IFS=',' read -ra TAG_ARRAY <<< "${TAGS}"
|
||||
for tag in "${TAG_ARRAY[@]}"; do
|
||||
TAG_ARGS="${TAG_ARGS} -t ${tag}"
|
||||
done
|
||||
|
||||
docker build \
|
||||
${TAG_ARGS} \
|
||||
--build-arg NEXT_PUBLIC_API_URL=${{ github.event.inputs.api_url || 'http://ut.khoavo.myds.me:8981/api' }} \
|
||||
.
|
||||
|
||||
for tag in "${TAG_ARRAY[@]}"; do
|
||||
echo "Pushing ${tag}..."
|
||||
docker push "${tag}"
|
||||
done
|
||||
|
||||
- name: Verify
|
||||
run: docker images | grep kv-tube
|
||||
10
.forgejo/workflows/test-dind.yml
Normal file
10
.forgejo/workflows/test-dind.yml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
name: Test DinD
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: docker-build
|
||||
steps:
|
||||
- run: echo "hostname:" && hostname
|
||||
- run: apk add --no-cache docker-cli && docker version
|
||||
Loading…
Reference in a new issue