From e226faf08a007e87608a16c0667095d78c2d48e3 Mon Sep 17 00:00:00 2001 From: Baghaztra Date: Wed, 15 Oct 2025 10:02:06 +0700 Subject: [PATCH] [Update] Docker --- .env.example | 27 +++++++++++++++------------ Dockerfile | 6 ++++-- docker-compose.yml | 6 ++++-- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.env.example b/.env.example index 5271f98..3435e25 100644 --- a/.env.example +++ b/.env.example @@ -1,12 +1,12 @@ -APP_NAME=Abbauf-Kasir +APP_NAME=KasirTMJC APP_ENV=local APP_KEY= APP_DEBUG=true -APP_URL=http://localhost:8000 +APP_URL=http://localhost -APP_LOCALE=en -APP_FALLBACK_LOCALE=en -APP_FAKER_LOCALE=en_US +APP_LOCALE=id +APP_FALLBACK_LOCALE=id +APP_FAKER_LOCALE=id_ID APP_MAINTENANCE_DRIVER=file # APP_MAINTENANCE_STORE=database @@ -20,12 +20,15 @@ LOG_STACK=single LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug -DB_CONNECTION=sqlite -# DB_HOST=127.0.0.1 -# DB_PORT=3306 -# DB_DATABASE=laravel -# DB_USERNAME=root -# DB_PASSWORD= +DB_CONNECTION=mysql +DB_HOST=mysql +DB_PORT=3306 +DB_DATABASE=kasir_db +DB_USERNAME=kasir_user +DB_PASSWORD=kasir_password + +# MySQL Root Password (untuk Docker) +MYSQL_ROOT_PASSWORD=root_password SESSION_DRIVER=database SESSION_LIFETIME=120 @@ -43,7 +46,7 @@ CACHE_STORE=database MEMCACHED_HOST=127.0.0.1 REDIS_CLIENT=phpredis -REDIS_HOST=127.0.0.1 +REDIS_HOST=redis REDIS_PASSWORD=null REDIS_PORT=6379 diff --git a/Dockerfile b/Dockerfile index 5035177..cb391c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,11 +24,13 @@ COPY . . COPY --from=node_builder /app/public/build /var/www/html/public/build RUN composer install --no-dev --optimize-autoloader +RUN php artisan storage:link || true RUN php artisan config:cache && php artisan route:cache && php artisan view:cache # Optimasi cache untuk performa laporan/transaksi # Set permission dan user non-root -RUN chown -R www-data:www-data /var/www/html -USER www-data +RUN chown -R www-data:www-data /var/www/html \ + && chmod -R 755 /var/www/html/storage \ + && chmod -R 755 /var/www/html/bootstrap/cache EXPOSE 9000 CMD ["php-fpm"] diff --git a/docker-compose.yml b/docker-compose.yml index df11581..b7cac6c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: dockerfile: Dockerfile container_name: laravel_app_prod volumes: - - ./storage:/var/www/html/storage + - storage_data:/var/www/html/storage ports: - "9000" depends_on: @@ -28,7 +28,8 @@ services: - "80:80" volumes: - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro - - ./storage:/var/www/html/storage:ro + volumes_from: + - laravel:ro depends_on: - laravel @@ -54,3 +55,4 @@ services: volumes: mysql_data: + storage_data: