Restructure Docker for Dokploy deployment
- Copy app code into PHP image, sync to shared volume at startup - Use named volume (app_code) shared between app and nginx - Build nginx image with embedded config (no bind mounts) - Add .dockerignore to optimize image build - Build context moved to project root for both services
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ./docker/php
|
||||
context: .
|
||||
dockerfile: docker/php/Dockerfile
|
||||
container_name: termanager2_app
|
||||
restart: unless-stopped
|
||||
working_dir: /var/www/html
|
||||
volumes:
|
||||
- .:/var/www/html
|
||||
- app_code:/var/www/html
|
||||
- storage_data:/var/www/html/storage/app
|
||||
networks:
|
||||
- termanager2
|
||||
@@ -19,14 +20,15 @@ services:
|
||||
- PHP_OPCACHE_VALIDATE_TIMESTAMPS=1
|
||||
|
||||
nginx:
|
||||
image: nginx:1.25-alpine
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/nginx/Dockerfile
|
||||
container_name: termanager2_nginx
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${APP_PORT:-8080}:80"
|
||||
volumes:
|
||||
- .:/var/www/html:ro
|
||||
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- app_code:/var/www/html:ro
|
||||
networks:
|
||||
- termanager2
|
||||
depends_on:
|
||||
@@ -81,6 +83,8 @@ services:
|
||||
- termanager2
|
||||
|
||||
volumes:
|
||||
app_code:
|
||||
driver: local
|
||||
db_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
|
||||
Reference in New Issue
Block a user