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]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-run:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -16,21 +16,22 @@ jobs:
|
|||||||
http = false
|
http = false
|
||||||
insecure = false
|
insecure = false
|
||||||
|
|
||||||
# Login to Docker Hub (optional)
|
# Login to Docker Hub for pulling base images (optional)
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
# Login to Gitea Registry with your custom secret name
|
# Login to Gitea Registry
|
||||||
- name: Login to Gitea Registry
|
- name: Login to Gitea Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: kode.sadateknologi.site
|
registry: kode.sadateknologi.site
|
||||||
username: ${{ gitea.repository_owner }}
|
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
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
@@ -38,4 +39,29 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
kode.sadateknologi.site/${{ gitea.repository_owner }}/kulakpos_web:latest
|
kode.sadateknologi.site/${{ gitea.repository_owner }}/kulakpos_web:latest
|
||||||
kode.sadateknologi.site/${{ gitea.repository_owner }}/kulakpos_web:${{ gitea.sha }}
|
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