Skip to content

Commit

Permalink
Run npm build for all env's
Browse files Browse the repository at this point in the history
  • Loading branch information
jragunanthan authored and abhijith-hr committed Oct 11, 2024
1 parent e685f86 commit 0b6afc4
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ EXPOSE 4010
# Install application dependencies
RUN npm install

# Define a build argument with a default value "dev"
ARG ENV=dev
RUN npm run build

# Set environment variable in the container
ENV NODE_ENV=$ENV

# Conditionally run build command based on the ENV argument
RUN if [ "$ENV" = "prod" ]; then \
npm run build; \
fi

CMD ["/bin/sh", "-c", "if [ \"$NODE_ENV\" = \"prod\" ]; then npm run start:prod; else npm run start:dev; fi"]
CMD ["npm", "run", "start:prod"]

0 comments on commit 0b6afc4

Please sign in to comment.