Last active
July 3, 2023 03:01
-
-
Save harrylowkey/024e050bc205f60d2add37b7a68d0515 to your computer and use it in GitHub Desktop.
Dockerfile for Nodejs server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:18-alpine As development | |
RUN apk update && apk add --no-cache bash git openssh | |
WORKDIR /usr/src/app | |
COPY package*.json ./ | |
RUN npm install | |
ADD . . | |
RUN npm run build | |
FROM node:18-alpine as production | |
WORKDIR /usr/src/app | |
COPY package*.json ./ | |
RUN npm ci --only=production | |
COPY --from=development /usr/src/app/dist ./dist | |
COPY --from=development /usr/src/app/node_modules/ ./node_modules/ | |
EXPOSE 3000 | |
CMD ["node", "/usr/src/app/dist/main.js"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment