-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (23 loc) · 911 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -----> Imagem de build
FROM node:latest AS build
RUN apt update && apt install -y --no-install-recommends dumb-init
WORKDIR /usr/src/app
COPY . ./
RUN npm install && (cd ./frontend && npm install)
RUN npm run build && (cd ./frontend && npm run build)
# -----> Imagem de produção
FROM node:18.13.0-bullseye-slim
COPY --from=build /usr/bin/dumb-init /usr/bin/dumb-init
# Criar pasta do banco de dados; um volume será montado aqui
RUN mkdir /data && chown node /data && chgrp node /data
ENV NODE_ENV production
WORKDIR /usr/src/app
# Instalar dependências
COPY --from=build /usr/src/app/package* /usr/src/app/
RUN npm install --production
# Copiar arquivos da aplicação
COPY --from=build /usr/src/app/build /usr/src/app/build
COPY --from=build /usr/src/app/frontend/build /usr/src/app/public
# A aplicação usa a porta 8000 internamente
EXPOSE 8000
CMD ["dumb-init", "node", "build/index.js"]