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.
This commit is contained in:
parent
9b2d4551b8
commit
0dfec52cf8
|
|
@ -4,12 +4,6 @@ services:
|
||||||
api:
|
api:
|
||||||
image: jhumanj/opnform-api:dev
|
image: jhumanj/opnform-api:dev
|
||||||
container_name: opnform-api
|
container_name: opnform-api
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: docker/Dockerfile.api
|
|
||||||
args:
|
|
||||||
APP_ENV: local
|
|
||||||
COMPOSER_FLAGS: ""
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./api:/usr/share/nginx/html:delegated
|
- ./api:/usr/share/nginx/html:delegated
|
||||||
- /usr/share/nginx/html/vendor # Exclude vendor directory from the mount
|
- /usr/share/nginx/html/vendor # Exclude vendor directory from the mount
|
||||||
|
|
@ -44,9 +38,6 @@ services:
|
||||||
ui:
|
ui:
|
||||||
image: jhumanj/opnform-client:dev
|
image: jhumanj/opnform-client:dev
|
||||||
container_name: opnform-client
|
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"
|
command: sh -c "npm install && NITRO_HOST=0.0.0.0 NITRO_PORT=3000 npm run dev"
|
||||||
volumes:
|
volumes:
|
||||||
- ./client:/app:delegated
|
- ./client:/app:delegated
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,6 @@ services:
|
||||||
api: &api-environment
|
api: &api-environment
|
||||||
image: jhumanj/opnform-api:latest
|
image: jhumanj/opnform-api:latest
|
||||||
container_name: opnform-api
|
container_name: opnform-api
|
||||||
build: &api-build
|
|
||||||
context: .
|
|
||||||
dockerfile: docker/Dockerfile.api
|
|
||||||
args:
|
|
||||||
APP_ENV: production
|
|
||||||
COMPOSER_FLAGS: --no-dev
|
|
||||||
volumes: &api-environment-volumes
|
volumes: &api-environment-volumes
|
||||||
- ./api/storage:/usr/share/nginx/html/storage:rw
|
- ./api/storage:/usr/share/nginx/html/storage:rw
|
||||||
environment: &api-env
|
environment: &api-env
|
||||||
|
|
@ -35,7 +29,6 @@ services:
|
||||||
api-worker:
|
api-worker:
|
||||||
<<: *api-environment
|
<<: *api-environment
|
||||||
container_name: opnform-api-worker
|
container_name: opnform-api-worker
|
||||||
build: *api-build
|
|
||||||
command: ["php", "artisan", "queue:work"]
|
command: ["php", "artisan", "queue:work"]
|
||||||
volumes: *api-environment-volumes
|
volumes: *api-environment-volumes
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -48,7 +41,6 @@ services:
|
||||||
api-scheduler:
|
api-scheduler:
|
||||||
<<: *api-environment
|
<<: *api-environment
|
||||||
container_name: opnform-api-scheduler
|
container_name: opnform-api-scheduler
|
||||||
build: *api-build
|
|
||||||
command: ["php", "artisan", "schedule:work"]
|
command: ["php", "artisan", "schedule:work"]
|
||||||
volumes: *api-environment-volumes
|
volumes: *api-environment-volumes
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -65,9 +57,6 @@ services:
|
||||||
ui:
|
ui:
|
||||||
image: jhumanj/opnform-client:latest
|
image: jhumanj/opnform-client:latest
|
||||||
container_name: opnform-client
|
container_name: opnform-client
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: docker/Dockerfile.client
|
|
||||||
env_file:
|
env_file:
|
||||||
- ./client/.env
|
- ./client/.env
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ RUN npm cache clean --force && \
|
||||||
# RUN npm install esbuild@0.21.5
|
# RUN npm install esbuild@0.21.5
|
||||||
|
|
||||||
ADD ./client/ /app/
|
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
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue