From c6673513ddfd223315d6767c0b48fbf30f107ee9 Mon Sep 17 00:00:00 2001 From: Mohammed Shifreen Date: Mon, 27 Jul 2026 01:39:30 +0530 Subject: [PATCH] More fixes to the compose and deploy scripts. Signed-off-by: Mohammed Shifreen --- compose.yml | 7 ++++++- docker/php/Dockerfile | 9 ++++++--- scripts/deploy.sh | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/compose.yml b/compose.yml index 8cd6bf2..50baec9 100644 --- a/compose.yml +++ b/compose.yml @@ -1,5 +1,8 @@ name: webifycms.com +volumes: + app-data: + networks: webifycms-site: driver: bridge @@ -13,6 +16,8 @@ services: dockerfile: ./docker/php/Dockerfile env_file: .env restart: always + volumes: + - app-data:/var/www/html networks: - webifycms-site @@ -21,7 +26,7 @@ services: container_name: ${APP_ID}-nginx image: nginx:alpine volumes: - - ./:/var/www/html + - app-data:/var/www/html:ro - ./docker/nginx/nginx.caddy.conf:/etc/nginx/conf.d/default.conf ports: - "${NGINX_PORT}:80" diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index a933a62..30179c5 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -29,9 +29,6 @@ COPY composer.* . # install dependencies by allowing Docker to use the auth.json file of the host RUN composer install --no-dev --no-autoloader --no-progress --no-interaction -# dump the autoloader -RUN composer dump-autoload --classmap-authoritative --no-dev - # copy application source COPY --chown=app:app . . @@ -39,6 +36,12 @@ COPY --chown=app:app . . COPY --from=frontend --chown=app:app /build/public/assets/ ./public/assets/ COPY --from=frontend --chown=app:app /build/public/.vite/ ./public/.vite/ +# copy images from source into public (not handled by Vite build) +COPY --chown=app:app assets/img/ ./public/assets/img/ + +# dump the autoloader (after source copy so classmap includes app classes) +RUN composer dump-autoload --classmap-authoritative --no-dev + # create non-root user RUN addgroup -g 1000 -S app && adduser -u 1000 -S app -G app diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 07d0f50..9a78b22 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -28,9 +28,9 @@ fi echo ">>> Pulling latest changes..." git pull origin main -# Stop existing containers +# Stop existing containers and remove volumes for a clean build echo ">>> Stopping existing containers..." -docker compose down +docker compose down -v # Build new image (no cache for clean build) echo ">>> Building Docker image..."