fix pipeline
This commit is contained in:
@@ -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"
|
||||
Reference in New Issue
Block a user