Skip to content

Commit 367da3e

Browse files
authored
Merge pull request #4 from josephgoksu/fix/dockerfile
refactor: dockerfile to install all dependencies and prune dev
2 parents b5dd024 + eb80cab commit 367da3e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

backend/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN apk add --no-cache python3 make g++
88

99
# Copy package files
1010
COPY package*.json ./
11-
RUN npm ci --only=production
11+
RUN npm ci
1212

1313
# Copy source code
1414
COPY src/ ./src/
@@ -17,6 +17,9 @@ COPY tsconfig.json ./
1717
# Build TypeScript
1818
RUN npm run build
1919

20+
# Remove dev dependencies for slimmer runtime image
21+
RUN npm prune --omit=dev
22+
2023
# Create data directory
2124
RUN mkdir -p /data && chown -R node:node /data
2225

@@ -31,4 +34,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
3134
CMD node -e "require('http').get('http://localhost:8080/health', (res) => process.exit(res.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"
3235

3336
# Start server
34-
CMD ["npm", "start"]
37+
CMD ["npm", "start"]

0 commit comments

Comments
 (0)