Created
February 13, 2024 21:28
-
-
Save owalacesilva/f7fff649b38e57186275ca19b6976f8f to your computer and use it in GitHub Desktop.
Dockerfile to nginx and nestjs application
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 --platform=linux/amd64 node:20.6.1-alpine3.18 AS base | |
RUN apk update | |
RUN apk add --no-cache dumb-init bash wget curl nginx | |
RUN mkdir -p /workspace | |
WORKDIR /workspace | |
FROM base AS dependencies | |
RUN npm install -g npm@10.2.0 | |
RUN npm install -g @nestjs/cli | |
COPY ./package*.json ./ | |
RUN npm install | |
COPY . . | |
FROM dependencies AS builder | |
COPY ./.docker/nginx/ /etc/nginx/ | |
RUN npm run build | |
RUN ln -sf /dev/stderr /var/log/nginx/error.log | |
STOPSIGNAL SIGTERM | |
EXPOSE 80 | |
CMD ["/bin/bash", "-c", "npm run start:prod & nginx -g 'daemon off;'"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment