This commit is contained in:
@@ -1,45 +1,58 @@
|
||||
name: Build and Push Docker Image
|
||||
name: Build-Push-Deploy-Dev
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
branches:
|
||||
- main
|
||||
|
||||
workflow_dispatch:
|
||||
# push:
|
||||
# branches:
|
||||
# - '**'
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.marktaguiad.dev
|
||||
IMAGE_NAME: ${{ gitea.repository }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Optional: only build when PR is merged
|
||||
# if: gitea.event.pull_request.merged == true
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Wait
|
||||
run: sleep 10
|
||||
|
||||
- name: Verify Docker daemon is running
|
||||
run: |
|
||||
echo "Testing Docker daemon connection..."
|
||||
docker info
|
||||
|
||||
- name: List running containers
|
||||
run: |
|
||||
echo "Listing all containers..."
|
||||
docker ps -a
|
||||
|
||||
- name: Test Docker functionality
|
||||
run: |
|
||||
echo "Testing basic Docker operations..."
|
||||
docker run --rm hello-world
|
||||
|
||||
- name: Verify DIND isolation
|
||||
run: |
|
||||
echo "Testing container isolation..."
|
||||
docker run --rm alpine:latest echo "DIND is working perfectly!"
|
||||
- name: Log in to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
Reference in New Issue
Block a user