Merge branch 'main' of ssh://forgejo/chaas/debshots
Some checks failed
Build and Push Docker Image / build-and-push-image (push) Failing after 3m13s
Some checks failed
Build and Push Docker Image / build-and-push-image (push) Failing after 3m13s
This commit is contained in:
commit
9340529d3f
1 changed files with 47 additions and 56 deletions
|
|
@ -1,72 +1,63 @@
|
|||
# =============================================================================
|
||||
# Forgejo Actions workflow to build and push Docker image
|
||||
# =============================================================================
|
||||
# Triggered on push to main or master branches
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
REGISTRY_URL: registry.coolify1.workaround.org
|
||||
# This creates: registry.coolify1.workaround.org/my-app:main-sha
|
||||
CONTAINER_IMAGE: registry.coolify1.workaround.org/debshots:stage
|
||||
RAILS_ENV: production
|
||||
#CONTAINER_IMAGE: ${{ secrets.REGISTRY_IMAGE }}:${{ github.ref_name }}-${{ github.sha }}
|
||||
DOCKER_HOST: tcp://localhost:2375
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-and-push-image:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: node:22 # Optionally install Docker CLI in a step
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
# -------------------------------------------------------------------------
|
||||
# Check out repository code
|
||||
# -------------------------------------------------------------------------
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Podman
|
||||
# -------------------------------------------------------------------------
|
||||
# Install Docker CLI (not cached in image, needed for buildx)
|
||||
# -------------------------------------------------------------------------
|
||||
- name: Install Docker
|
||||
run: |
|
||||
apt-get update && apt-get install -y podman buildah
|
||||
apt-get update -qq
|
||||
apt-get install -y --no-install-recommends docker.io
|
||||
|
||||
- name: Podman info
|
||||
run: podman info
|
||||
# -------------------------------------------------------------------------
|
||||
# Set up Docker Buildx for layer caching
|
||||
# -------------------------------------------------------------------------
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build with Buildah
|
||||
run: |
|
||||
# 'bud' stands for Build-Using-Dockerfile
|
||||
buildah bud \
|
||||
--storage-driver vfs \
|
||||
--isolation chroot \
|
||||
--net host \
|
||||
-t "$CONTAINER_IMAGE" .
|
||||
|
||||
# Tagging is just as simple
|
||||
buildah tag "$CONTAINER_IMAGE" "${{ secrets.REGISTRY_IMAGE }}:latest"
|
||||
# -------------------------------------------------------------------------
|
||||
# Authenticate with Forgejo container registry
|
||||
# -------------------------------------------------------------------------
|
||||
- name: Login to Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.pmd5.org
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.FORGEJO_TOKEN }}
|
||||
|
||||
- name: Log in to registry
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | podman login \
|
||||
-u "${{ secrets.REGISTRY_USER }}" \
|
||||
--password-stdin \
|
||||
${{ secrets.REGISTRY_URL }}
|
||||
|
||||
# - name: Push with Buildah
|
||||
# run: |
|
||||
# # Buildah needs a 'docker://' prefix for remote registries
|
||||
# # It will use the credentials from your previous 'podman login'
|
||||
# # OR you can login directly with buildah:
|
||||
# buildah push \
|
||||
# --storage-driver vfs \
|
||||
# --creds "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASSWORD }}" \
|
||||
# "$CONTAINER_IMAGE" \
|
||||
# "docker://${{ secrets.REGISTRY_IMAGE }}:latest"
|
||||
|
||||
# - name: Build Docker image
|
||||
# run: |
|
||||
# podman build -t "$CONTAINER_IMAGE" .
|
||||
# podman tag "$CONTAINER_IMAGE" "${{ secrets.REGISTRY_IMAGE }}:latest"
|
||||
#
|
||||
# - name: Push Docker image
|
||||
# run: |
|
||||
# docker push "$CONTAINER_IMAGE"
|
||||
# docker push "${{ secrets.REGISTRY_IMAGE }}:latest"
|
||||
# -------------------------------------------------------------------------
|
||||
# Build and push image with GitHub Actions cache
|
||||
# -------------------------------------------------------------------------
|
||||
- name: Build and Push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: git.pmd5.org/${{ github.repository }}:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue