diff --git a/Dockerfile b/Dockerfile index b6cd3437..6a6b3f6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" ] +