ci: simplify workflows to use docker CLI only
Some checks failed
Pull Request Validation / validate-pr-title (pull_request) Successful in 0s
Pull Request Validation / validate-docker (pull_request) Failing after 1s
Pull Request Validation / build-test (pull_request) Failing after 1s
Pull Request Validation / check-files (pull_request) Failing after 0s
Some checks failed
Pull Request Validation / validate-pr-title (pull_request) Successful in 0s
Pull Request Validation / validate-docker (pull_request) Failing after 1s
Pull Request Validation / build-test (pull_request) Failing after 1s
Pull Request Validation / check-files (pull_request) Failing after 0s
- remove Node-based actions (checkout, buildx, login, build-push) - rely on gitea workspace checkout and plain docker commands - avoid Node requirement on self-hosted runner
This commit is contained in:
@@ -13,56 +13,26 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: linux
|
runs-on: linux
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Build Docker image
|
||||||
uses: actions/checkout@v4
|
run: |
|
||||||
|
echo "Building Docker image..."
|
||||||
- name: Set up Docker Buildx
|
docker build -t karaokepedia:latest .
|
||||||
uses: docker/setup-buildx-action@v3
|
docker tag karaokepedia:latest karaokepedia:${{ github.sha }}
|
||||||
|
echo "✅ Image built successfully"
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
- name: Log in to Docker Hub
|
||||||
uses: docker/login-action@v3
|
run: |
|
||||||
with:
|
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
# Uncomment if using GitHub Container Registry
|
- name: Push Docker image
|
||||||
# - name: Log in to GitHub Container Registry
|
run: |
|
||||||
# uses: docker/login-action@v3
|
# Push with registry prefix if secrets are configured
|
||||||
# with:
|
if [ -n "${{ secrets.DOCKER_USERNAME }}" ]; then
|
||||||
# registry: ghcr.io
|
docker tag karaokepedia:latest ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||||
# username: ${{ github.actor }}
|
docker tag karaokepedia:latest ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:main-${{ github.sha }}
|
||||||
# password: ${{ secrets.GITHUB_TOKEN }}
|
docker push ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
docker push ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:main-${{ github.sha }}
|
||||||
# Uncomment if using Gitea Container Registry
|
echo "✅ Pushed to Docker Hub: ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}"
|
||||||
# - name: Log in to Gitea Container Registry
|
else
|
||||||
# uses: docker/login-action@v3
|
echo "⚠️ Docker Hub credentials not configured, skipping push"
|
||||||
# with:
|
fi
|
||||||
# registry: gitea.yourdomain.com
|
|
||||||
# username: ${{ secrets.GITEA_USERNAME }}
|
|
||||||
# password: ${{ secrets.GITEA_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Extract metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}
|
|
||||||
# Use this for GHCR:
|
|
||||||
# images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
|
|
||||||
# Use this for Gitea:
|
|
||||||
# images: gitea.yourdomain.com/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
|
|
||||||
tags: |
|
|
||||||
type=raw,value=latest
|
|
||||||
type=sha,prefix={{branch}}-
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
- name: Image digest
|
|
||||||
run: echo ${{ steps.meta.outputs.digest }}
|
|
||||||
|
|||||||
@@ -49,9 +49,6 @@ jobs:
|
|||||||
validate-docker:
|
validate-docker:
|
||||||
runs-on: linux
|
runs-on: linux
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Validate Dockerfile syntax
|
- name: Validate Dockerfile syntax
|
||||||
run: |
|
run: |
|
||||||
if [ -f "Dockerfile" ]; then
|
if [ -f "Dockerfile" ]; then
|
||||||
@@ -86,22 +83,7 @@ jobs:
|
|||||||
build-test:
|
build-test:
|
||||||
runs-on: linux
|
runs-on: linux
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Build and test Docker image
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Build Docker image (no push)
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: false
|
|
||||||
tags: karaokepedia:pr-${{ github.event.pull_request.number }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
- name: Test container starts
|
|
||||||
run: |
|
run: |
|
||||||
docker build -t karaokepedia:test .
|
docker build -t karaokepedia:test .
|
||||||
CONTAINER_ID=$(docker run -d -p 8080:80 karaokepedia:test)
|
CONTAINER_ID=$(docker run -d -p 8080:80 karaokepedia:test)
|
||||||
@@ -145,9 +127,6 @@ jobs:
|
|||||||
check-files:
|
check-files:
|
||||||
runs-on: linux
|
runs-on: linux
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Check required files exist
|
- name: Check required files exist
|
||||||
run: |
|
run: |
|
||||||
REQUIRED_FILES=(
|
REQUIRED_FILES=(
|
||||||
|
|||||||
Reference in New Issue
Block a user