fix pipeline
Some checks failed
Build, Push and Deploy / build-and-deploy (push) Failing after 1m13s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s

This commit is contained in:
eko
2026-03-16 06:41:29 +07:00
parent 4caa46910a
commit 3f5cdcc558
2 changed files with 29 additions and 45 deletions

View File

@@ -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

View File

@@ -1,9 +1,11 @@
FROM php:8.2-fpm-alpine
# Install PostgreSQL extensions
# Install dependencies
RUN apk add --no-cache \
libzip-dev \
postgresql-dev \
git \
curl \
&& docker-php-ext-install -j$(nproc) \
pdo_pgsql \
pgsql \
@@ -15,12 +17,21 @@ RUN apk add --no-cache \
opcache \
zip
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
# Copy composer files first (for better caching)
COPY composer.json composer.lock ./
# Install dependencies
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader
# Copy application files
COPY --chown=www-data:www-data . .
# Create all necessary directories with proper permissions
# Create necessary directories
RUN mkdir -p storage/framework/{cache,sessions,views} \
&& mkdir -p storage/logs \
&& mkdir -p bootstrap/cache \
@@ -29,7 +40,7 @@ RUN mkdir -p storage/framework/{cache,sessions,views} \
&& chmod 777 storage/framework/sessions \
&& chmod 777 storage/logs
# Create startup script to handle different modes
# Create startup script
RUN echo '#!/bin/sh' > /start.sh && \
echo 'if [ "$MODE" = "dev" ]; then' >> /start.sh && \
echo ' echo "Starting in DEV mode with PHP built-in server on port 8000..."' >> /start.sh && \
@@ -40,10 +51,6 @@ RUN echo '#!/bin/sh' > /start.sh && \
echo 'fi' >> /start.sh && \
chmod +x /start.sh
# Verify permissions (for debugging)
RUN ls -la storage/framework/
EXPOSE 8000 9000
# Use the startup script
CMD ["/start.sh"]