initial
This commit is contained in:
31
api/Dockerfile
Normal file
31
api/Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
FROM node:18 AS development
|
||||
WORKDIR /api/src
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
################
|
||||
## PRODUCTION ##
|
||||
################
|
||||
# Build another image named production
|
||||
FROM node:18 AS production
|
||||
|
||||
# Set node env to prod
|
||||
ARG NODE_ENV=production
|
||||
ENV NODE_ENV=${NODE_ENV}
|
||||
|
||||
# Set Working Directory
|
||||
WORKDIR /api/src
|
||||
|
||||
# Copy all from development stage
|
||||
COPY --from=development /api/src/ .
|
||||
|
||||
EXPOSE 4000
|
||||
|
||||
# Run app
|
||||
CMD [ "node", "dist/main" ]
|
||||
|
||||
# Example Commands to build and run the dockerfile
|
||||
# docker build -t thomas-nest .
|
||||
# docker run thomas-nest
|
||||
Reference in New Issue
Block a user