72 lines
2.2 KiB
YAML
72 lines
2.2 KiB
YAML
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
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: docker
|
|
container:
|
|
image: node:22 # Optionally install Docker CLI in a step
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Podman
|
|
run: |
|
|
apt-get update && apt-get install -y podman buildah
|
|
|
|
- name: Podman info
|
|
run: podman info
|
|
|
|
- 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"
|
|
|
|
- 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"
|