git-rest-api/Dockerfile

36 строки
771 B
Docker
Исходник Обычный вид История

# Base Stage
2020-08-21 12:59:46 +03:00
FROM ubuntu:18.04 as base
2019-05-16 22:09:44 +03:00
RUN mkdir /app
WORKDIR /app
2019-05-16 22:09:44 +03:00
2020-08-21 12:59:46 +03:00
ENV PKG_ADD="curl"
ENV PKG_ADD_BUILD="libkrb5-dev krb5-config gcc g++ make"
RUN apt update && apt upgrade -y && apt install $PKG_ADD -y
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt install nodejs -y
# Build Stage
2020-08-21 12:59:46 +03:00
FROM base AS builder
RUN apt install $PKG_ADD_BUILD -y
COPY package.json package-lock.json .prettierrc.yml ./
2020-08-21 12:59:46 +03:00
RUN npm ci
COPY . .
RUN npm run build
ARG SKIP_TEST
RUN if [ -z "${SKIP_TEST}" ]; then npm run test; fi
RUN npm prune --production
# Prod Stage
FROM base as prod
COPY package.json package-lock.json ./
COPY --from=builder /app/bin ./bin
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3009
ENV NODE_ENV=production
2019-05-16 22:09:44 +03:00
CMD npm run start:prod