fix pipeline
All checks were successful
Build, Push and Run Container / build-and-run (push) Successful in 1m53s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 9s

This commit is contained in:
eko
2026-03-16 06:28:58 +07:00
parent 0dc65d0e0e
commit 4caa46910a

View File

@@ -1,8 +1,8 @@
name: Build and Push to Gitea Registry
name: Build, Push and Run Container
on: [push]
jobs:
build-and-push:
build-and-run:
runs-on: ubuntu-latest
steps:
- name: Checkout code
@@ -16,21 +16,22 @@ jobs:
http = false
insecure = false
# Login to Docker Hub (optional)
# Login to Docker Hub for pulling base images (optional)
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Login to Gitea Registry with your custom secret name
# Login to Gitea Registry
- name: Login to Gitea Registry
uses: docker/login-action@v3
with:
registry: kode.sadateknologi.site
username: ${{ gitea.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }} # Using custom name
password: ${{ secrets.REGISTRY_TOKEN }}
# Build and push image to Gitea Registry
- name: Build and push
uses: docker/build-push-action@v5
with:
@@ -39,3 +40,28 @@ jobs:
tags: |
kode.sadateknologi.site/${{ gitea.repository_owner }}/kulakpos_web:latest
kode.sadateknologi.site/${{ gitea.repository_owner }}/kulakpos_web:${{ gitea.sha }}
# Stop and remove existing container (if any)
- name: Stop existing container
run: |
docker stop kulakpos_web || true
docker rm kulakpos_web || true
continue-on-error: true
# Run the new container
- name: Run container
run: |
docker run -d \
--name kulakpos_web \
--restart unless-stopped \
-p 8000:8000 \
-e PORT=8000 \
-e NODE_ENV=production \
kode.sadateknologi.site/${{ gitea.repository_owner }}/kulakpos_web:latest
# Verify container is running
- name: Verify container
run: |
sleep 5
docker ps | grep kulakpos_web
curl -f http://localhost:8000/health || echo "Health check endpoint not configured"