This commit is contained in:
Bastian Wagner
2024-09-12 15:12:08 +02:00
commit 24b00e6fa1
19 changed files with 9024 additions and 0 deletions

31
api/Dockerfile Normal file
View 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