[Update] Docker

This commit is contained in:
Baghaztra 2025-10-15 10:02:06 +07:00
parent b43b098936
commit e226faf08a
3 changed files with 23 additions and 16 deletions

View File

@ -1,12 +1,12 @@
APP_NAME=Abbauf-Kasir APP_NAME=KasirTMJC
APP_ENV=local APP_ENV=local
APP_KEY= APP_KEY=
APP_DEBUG=true APP_DEBUG=true
APP_URL=http://localhost:8000 APP_URL=http://localhost
APP_LOCALE=en APP_LOCALE=id
APP_FALLBACK_LOCALE=en APP_FALLBACK_LOCALE=id
APP_FAKER_LOCALE=en_US APP_FAKER_LOCALE=id_ID
APP_MAINTENANCE_DRIVER=file APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database # APP_MAINTENANCE_STORE=database
@ -20,12 +20,15 @@ LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug LOG_LEVEL=debug
DB_CONNECTION=sqlite DB_CONNECTION=mysql
# DB_HOST=127.0.0.1 DB_HOST=mysql
# DB_PORT=3306 DB_PORT=3306
# DB_DATABASE=laravel DB_DATABASE=kasir_db
# DB_USERNAME=root DB_USERNAME=kasir_user
# DB_PASSWORD= DB_PASSWORD=kasir_password
# MySQL Root Password (untuk Docker)
MYSQL_ROOT_PASSWORD=root_password
SESSION_DRIVER=database SESSION_DRIVER=database
SESSION_LIFETIME=120 SESSION_LIFETIME=120
@ -43,7 +46,7 @@ CACHE_STORE=database
MEMCACHED_HOST=127.0.0.1 MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1 REDIS_HOST=redis
REDIS_PASSWORD=null REDIS_PASSWORD=null
REDIS_PORT=6379 REDIS_PORT=6379

View File

@ -24,11 +24,13 @@ COPY . .
COPY --from=node_builder /app/public/build /var/www/html/public/build COPY --from=node_builder /app/public/build /var/www/html/public/build
RUN composer install --no-dev --optimize-autoloader 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 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 # Set permission dan user non-root
RUN chown -R www-data:www-data /var/www/html RUN chown -R www-data:www-data /var/www/html \
USER www-data && chmod -R 755 /var/www/html/storage \
&& chmod -R 755 /var/www/html/bootstrap/cache
EXPOSE 9000 EXPOSE 9000
CMD ["php-fpm"] CMD ["php-fpm"]

View File

@ -5,7 +5,7 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: laravel_app_prod container_name: laravel_app_prod
volumes: volumes:
- ./storage:/var/www/html/storage - storage_data:/var/www/html/storage
ports: ports:
- "9000" - "9000"
depends_on: depends_on:
@ -28,7 +28,8 @@ services:
- "80:80" - "80:80"
volumes: volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ./storage:/var/www/html/storage:ro volumes_from:
- laravel:ro
depends_on: depends_on:
- laravel - laravel
@ -54,3 +55,4 @@ services:
volumes: volumes:
mysql_data: mysql_data:
storage_data: