This commit is contained in:
commit
7f02ea62b3
31
.gitea/workflows/build-and-push.yaml
Normal file
31
.gitea/workflows/build-and-push.yaml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
name: build-and-upload-docker
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- trunk
|
||||||
|
paths:
|
||||||
|
- 'Dockerfile'
|
||||||
|
- 'rootfs/**'
|
||||||
|
- 'build.sh'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
run: |
|
||||||
|
chmod +x ./build.sh
|
||||||
|
./build.sh
|
||||||
2
Dockerfile
Normal file
2
Dockerfile
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
FROM gitea/act_runner:latest
|
||||||
|
RUN apk add --no-cache nodejs npm
|
||||||
18
build-and-push.sh
Executable file
18
build-and-push.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
IMAGE_NAME="rbvtopudding/gitea-act_runner"
|
||||||
|
TAG="${1:-latest}"
|
||||||
|
FULL_IMAGE_NAME="${IMAGE_NAME}:${TAG}"
|
||||||
|
|
||||||
|
# Get the directory where the script is located
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
echo "Building Docker image: ${FULL_IMAGE_NAME}"
|
||||||
|
docker build -t "${FULL_IMAGE_NAME}" "${SCRIPT_DIR}"
|
||||||
|
|
||||||
|
echo "Pushing Docker image to Docker Hub: ${FULL_IMAGE_NAME}"
|
||||||
|
docker push "${FULL_IMAGE_NAME}"
|
||||||
|
|
||||||
|
echo "Successfully built and pushed ${FULL_IMAGE_NAME}"
|
||||||
Loading…
x
Reference in New Issue
Block a user