Add bash script instead of inline
All checks were successful
Publish Builder Image / build-and-push (push) Successful in 3m15s
All checks were successful
Publish Builder Image / build-and-push (push) Successful in 3m15s
This commit is contained in:
@ -1,46 +0,0 @@
|
||||
name: Publish Builder Image
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# 1. Define the container for the ENTIRE job
|
||||
container:
|
||||
image: quay.io/buildah/stable
|
||||
# 2. IMPORTANT: We must pass the privileged flag here for Buildah to work
|
||||
options: --privileged
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# 3. Now you can use the standard 'run' keyword!
|
||||
- name: Build and Push
|
||||
env:
|
||||
USERNAME: ${{ gitea.actor }}
|
||||
PASSWORD: ${{ secrets.USER_PACKAGE_PASSWORD }}
|
||||
REGISTRY: gitea.212.63.210.91.nip.io
|
||||
IMAGE: ${{ gitea.repository_owner }}/godot-builder
|
||||
TAG: ${{ gitea.sha }}
|
||||
run: |
|
||||
# Now comments are safe because 'run' uses a script file, not a one-liner.
|
||||
|
||||
# 1. Login to the registry
|
||||
# We use --tls-verify=false for your internal Traefik certs
|
||||
buildah login -u $USERNAME -p $PASSWORD --tls-verify=false --storage-driver=vfs $REGISTRY
|
||||
|
||||
# 2. Build the image
|
||||
# Using the 'vfs' driver is slower but more stable for nested containers
|
||||
buildah build \
|
||||
--tls-verify=false \
|
||||
--storage-driver=vfs \
|
||||
-f Dockerfile \
|
||||
-t $REGISTRY/$IMAGE:$TAG \
|
||||
-t $REGISTRY/$IMAGE:latest \
|
||||
.
|
||||
|
||||
# 3. Push the tags
|
||||
buildah push --tls-verify=false --storage-driver=vfs $REGISTRY/$IMAGE:$TAG
|
||||
buildah push --tls-verify=false --storage-driver=vfs $REGISTRY/$IMAGE:latest
|
||||
@ -20,13 +20,6 @@ jobs:
|
||||
TAG: ${{ gitea.sha }}
|
||||
with:
|
||||
entrypoint: /bin/sh
|
||||
args: -c "
|
||||
buildah login -u $USERNAME -p $PASSWORD --tls-verify=false --storage-driver=vfs $REGISTRY &&
|
||||
|
||||
buildah build --tls-verify=false --storage-driver=vfs -t $REGISTRY/$IMAGE:$TAG -t $REGISTRY/$IMAGE:latest . &&
|
||||
|
||||
buildah push --tls-verify=false --storage-driver=vfs $REGISTRY/$IMAGE:$TAG &&
|
||||
|
||||
buildah push --tls-verify=false --storage-driver=vfs $REGISTRY/$IMAGE:latest
|
||||
"
|
||||
# We just tell it to run the script we checked out
|
||||
args: ./build.sh
|
||||
|
||||
|
||||
25
build.sh
Normal file
25
build.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -e # Exit immediately if a command fails
|
||||
|
||||
# 1. Login to Gitea Registry
|
||||
# We use the environment variables passed from the workflow
|
||||
echo "Logging in to $REGISTRY..."
|
||||
buildah login -u "$USERNAME" -p "$PASSWORD" --tls-verify=false --storage-driver=vfs "$REGISTRY"
|
||||
|
||||
# 2. Build the Image
|
||||
# We build both the specific SHA tag and the 'latest' tag
|
||||
echo "Building image $IMAGE..."
|
||||
buildah build \
|
||||
--tls-verify=false \
|
||||
--storage-driver=vfs \
|
||||
-f Dockerfile \
|
||||
-t "$REGISTRY/$IMAGE:$TAG" \
|
||||
-t "$REGISTRY/$IMAGE:latest" \
|
||||
.
|
||||
|
||||
# 3. Push the Images
|
||||
echo "Pushing images..."
|
||||
buildah push --tls-verify=false --storage-driver=vfs "$REGISTRY/$IMAGE:$TAG"
|
||||
buildah push --tls-verify=false --storage-driver=vfs "$REGISTRY/$IMAGE:latest"
|
||||
|
||||
echo "Done!"
|
||||
Reference in New Issue
Block a user