From 0dfec52cf886dc782540738dbe06a51e2e21021e Mon Sep 17 00:00:00 2001 From: JhumanJ Date: Thu, 15 May 2025 20:07:39 +0200 Subject: [PATCH] Refactor Docker Configuration and Enhance Build Process - Removed the build context and Dockerfile specification from the `docker-compose.dev.yml` and `docker-compose.yml` files for the `ui` service, streamlining the configuration. - Increased Node memory limit in the `Dockerfile.client` to prevent out of memory errors during the build process, ensuring smoother builds and improved performance. These changes aim to simplify the Docker setup and enhance the reliability of the build process for the client application. --- docker-compose.dev.yml | 9 --------- docker-compose.yml | 11 ----------- docker/Dockerfile.client | 3 ++- 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 36084769..7b85cbef 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -4,12 +4,6 @@ services: api: image: jhumanj/opnform-api:dev container_name: opnform-api - build: - context: . - dockerfile: docker/Dockerfile.api - args: - APP_ENV: local - COMPOSER_FLAGS: "" volumes: - ./api:/usr/share/nginx/html:delegated - /usr/share/nginx/html/vendor # Exclude vendor directory from the mount @@ -44,9 +38,6 @@ services: ui: image: jhumanj/opnform-client:dev container_name: opnform-client - build: - context: . - dockerfile: docker/Dockerfile.client command: sh -c "npm install && NITRO_HOST=0.0.0.0 NITRO_PORT=3000 npm run dev" volumes: - ./client:/app:delegated diff --git a/docker-compose.yml b/docker-compose.yml index 78cc3d33..22402e96 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,12 +3,6 @@ services: api: &api-environment image: jhumanj/opnform-api:latest container_name: opnform-api - build: &api-build - context: . - dockerfile: docker/Dockerfile.api - args: - APP_ENV: production - COMPOSER_FLAGS: --no-dev volumes: &api-environment-volumes - ./api/storage:/usr/share/nginx/html/storage:rw environment: &api-env @@ -35,7 +29,6 @@ services: api-worker: <<: *api-environment container_name: opnform-api-worker - build: *api-build command: ["php", "artisan", "queue:work"] volumes: *api-environment-volumes environment: @@ -48,7 +41,6 @@ services: api-scheduler: <<: *api-environment container_name: opnform-api-scheduler - build: *api-build command: ["php", "artisan", "schedule:work"] volumes: *api-environment-volumes environment: @@ -65,9 +57,6 @@ services: ui: image: jhumanj/opnform-client:latest container_name: opnform-client - build: - context: . - dockerfile: docker/Dockerfile.client env_file: - ./client/.env diff --git a/docker/Dockerfile.client b/docker/Dockerfile.client index 846ee368..eac0d785 100644 --- a/docker/Dockerfile.client +++ b/docker/Dockerfile.client @@ -20,7 +20,8 @@ RUN npm cache clean --force && \ # RUN npm install esbuild@0.21.5 ADD ./client/ /app/ -RUN npm run build +# Increase Node memory limit to prevent out of memory error during build +RUN NODE_OPTIONS="--max-old-space-size=4096" npm run build FROM node:20-alpine WORKDIR /app