Skip to content

Commit 1e45e6f

Browse files
fix(docker): update Docker configurations and ignore files
- Added '*.vhdx' and 'workers/main/node_modules' to .dockerignore to prevent unnecessary files from being included in the Docker context. - Removed NODE_ENV setting from docker-compose.prod.yml to streamline production configuration. - Removed NODE_ENV setting from docker-compose.yml to ensure consistency across environments. - Updated Dockerfile.temporal-worker-main to ignore scripts during npm install, improving build efficiency. These changes enhance the Docker setup by optimizing the build process and ensuring cleaner configurations for production and development environments.
1 parent 9bbfd7c commit 1e45e6f

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

.dockerignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,7 @@ volumes/
139139
*.vdi
140140
*.qcow2
141141
*.raw
142-
*.vhdx
142+
*.vhdx
143+
144+
# Workers
145+
workers/main/node_modules

Dockerfile.temporal-worker-main

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1+
# Install dependencies only
12
FROM node:20-bullseye AS deps
23
WORKDIR /app
34
COPY workers/main/package*.json ./
4-
RUN npm ci
5+
RUN npm ci --ignore-scripts
56

7+
# Development image
68
FROM node:20-bullseye AS dev
7-
WORKDIR /app
8-
COPY --from=deps /app/node_modules ./node_modules
99
# sonarcloud-disable-next-line docker:S4507
1010
ENV NODE_ENV=development
11-
COPY workers/main ./
11+
WORKDIR /app
12+
COPY --from=deps /app/node_modules ./node_modules
1213
CMD ["npx", "nodemon", "--watch", "./", "--ext", "ts", "--exec", "npx", "ts-node", "src/index.ts"]
1314

15+
# Build the app
1416
FROM node:20-bullseye AS build
1517
WORKDIR /app
1618
COPY --from=deps /app/node_modules ./node_modules
1719
COPY workers/main/ ./
1820
RUN npm run build
1921

22+
# Production image
2023
FROM gcr.io/distroless/nodejs20-debian11 AS production
24+
ARG NODE_ENV=production
25+
ENV NODE_ENV=${NODE_ENV}
2126
WORKDIR /app
2227
COPY --from=build /app/dist ./build
2328
COPY --from=build /app/node_modules ./node_modules
2429

25-
ARG NODE_ENV=production
26-
ENV NODE_ENV=${NODE_ENV}
27-
2830
USER node
29-
3031
CMD ["node", "build/worker.js"]

docker-compose.prod.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ services:
107107
context: .
108108
dockerfile: Dockerfile.temporal-worker-main
109109
target: production
110-
environment:
111-
- NODE_ENV=production
112110

113111
volumes:
114112
n8n_data:

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ services:
158158
environment:
159159
- TEMPORAL_ADDRESS=temporal:7233
160160
- TEMPORAL_TASK_QUEUE=default
161-
- NODE_ENV=development
162161
volumes:
163162
- ./workers/main:/app
164163
- /app/node_modules

0 commit comments

Comments
 (0)