2020-01-19 12:02:22 +03:00
|
|
|
# Base Stage
|
2020-08-21 12:59:46 +03:00
|
|
|
FROM ubuntu:18.04 as base
|
2019-05-16 22:09:44 +03:00
|
|
|
|
2020-01-19 12:02:22 +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
|
2019-06-05 00:09:01 +03:00
|
|
|
|
2020-01-19 12:02:22 +03:00
|
|
|
# Build Stage
|
2020-08-21 12:59:46 +03:00
|
|
|
FROM base AS builder
|
|
|
|
RUN apt install $PKG_ADD_BUILD -y
|
|
|
|
|
2020-01-19 12:02:22 +03:00
|
|
|
COPY package.json package-lock.json .prettierrc.yml ./
|
2020-08-21 12:59:46 +03:00
|
|
|
RUN npm ci
|
2020-01-19 12:02:22 +03:00
|
|
|
|
|
|
|
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
|
2019-06-05 00:09:01 +03:00
|
|
|
|
2020-01-19 12:02:22 +03:00
|
|
|
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
|