Skip to content

Commit

Permalink
chore: Add conditional command to enable profiling in Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
betschki committed Aug 30, 2024
1 parent 6f84d4c commit 5969800
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Stage 1: Build the application
FROM node:20-alpine as builder

# Set the working directory in the container
WORKDIR /app

# Copy package.json and yarn.lock files
Expand Down Expand Up @@ -31,9 +30,14 @@ COPY --from=builder /app/dist ./dist

ENV NODE_ENV=production
ENV PORT=3000
ENV ENABLE_PROFILING=false

# Expose the port the app runs on
EXPOSE 3000

# Run the application
CMD ["node", "dist/index.js"]
# Conditional command to enable profiling if requested
CMD if [ "$ENABLE_PROFILING" = "true" ]; then \
node --inspect=0.0.0.0:9229 --max-old-space-size=2048 dist/index.js; \
else \
node dist/index.js; \
fi

0 comments on commit 5969800

Please sign in to comment.