Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
#
# ---- Base Node ----
FROM node:10-alpine AS base
# set working directory

# Definir diretório de trabalho
WORKDIR /usr/src/app

# copy project file
# Copiar arquivos do projeto
COPY package*.json ./
EXPOSE 8000
# copy app sources
COPY . .

#
# ---- Dependencies ----
FROM base AS dependencies

# Instalar dependências do sistema
RUN apk add --no-cache make gcc g++ python python3 linux-headers udev git
RUN git config --global url."https://github.com".insteadOf "ssh://git@github.com"
# install node packages
RUN npm set progress=false && npm config set depth 0
RUN npm ci

# Forçar HTTPS no Git
RUN git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"

# Forçar HTTPS no npm (evita erro ao baixar dependências)
RUN npm config set strict-ssl false
RUN npm config set progress=false && npm config set depth 0

# Instalar pacotes npm sem erros de permissão
RUN npm ci --unsafe-perm

#
# ---- Test ----
# run linters, setup and tests
FROM dependencies AS test
#RUN npm run lint && npm run setup && npm run test
RUN npm run test
RUN npm run test

#
# ---- Dev ----
FROM dependencies AS dev

# Instalar Nodemon globalmente
RUN npm install && npm install -g nodemon
# copy production node_modules

# Copiar módulos do ambiente de dependências
COPY --from=dependencies /usr/src/app/node_modules node_modules
# define CMD

# Definir comando padrão
CMD [ "npm", "run", "start-server" ]