fix pipeline
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
name: Build, Push and Run Container
|
||||
on: [push]
|
||||
name: Build, Push and Deploy
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
|
||||
jobs:
|
||||
build-and-run:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -10,20 +12,7 @@ jobs:
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
config-inline: |
|
||||
[registry."kode.sadateknologi.site"]
|
||||
http = false
|
||||
insecure = false
|
||||
|
||||
# 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
|
||||
- name: Login to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@@ -31,37 +20,25 @@ jobs:
|
||||
username: ${{ gitea.repository_owner }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
# Build and push image to Gitea Registry
|
||||
- name: Build and push
|
||||
# Build with the FIXED Dockerfile that includes composer install
|
||||
- name: Build and push fixed image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
kode.sadateknologi.site/${{ gitea.repository_owner }}/kulakpos_web:latest
|
||||
kode.sadateknologi.site/${{ gitea.repository_owner }}/kulakpos_web:${{ gitea.sha }}
|
||||
kode.sadateknologi.site/yanto/kulakpos_web:latest
|
||||
kode.sadateknologi.site/yanto/kulakpos_web:${{ gitea.sha }}
|
||||
|
||||
# Stop and remove existing container (if any)
|
||||
- name: Stop existing container
|
||||
# Deploy the fixed image
|
||||
- name: Deploy
|
||||
run: |
|
||||
docker stop kulakpos_web || true
|
||||
docker rm kulakpos_web || true
|
||||
continue-on-error: true
|
||||
|
||||
# Run the new container
|
||||
- name: Run container
|
||||
run: |
|
||||
docker pull kode.sadateknologi.site/yanto/kulakpos_web:latest
|
||||
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"
|
||||
-e MODE=dev \
|
||||
-e APP_ENV=local \
|
||||
kode.sadateknologi.site/yanto/kulakpos_web:latest
|
||||
Reference in New Issue
Block a user