From 4e816d902050421bd83064e05f4c62b0d4913a0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Fri, 14 Dec 2018 23:10:48 +0100 Subject: [PATCH] Fix (?) the build with an image tag for builder Also I added a base stage so we can have a common working directory. --- Dockerfile | 22 ++++++++-------------- docker-compose.override.yml | 1 + 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index d0080e3c4..ed6c274ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,23 @@ -FROM node:10-alpine as builder +FROM node:10-alpine as base LABEL Description="Backend of the Social Network Human-Connection.org" Vendor="Human Connection gGmbH" Version="0.0.1" Maintainer="Human Connection gGmbH (developer@human-connection.org)" -# Expose the app port EXPOSE 4000 - ARG BUILD_COMMIT ENV BUILD_COMMIT=$BUILD_COMMIT ARG WORKDIR=/nitro-backend RUN mkdir -p $WORKDIR WORKDIR $WORKDIR - -# Install the Application Dependencies -COPY package.json . -COPY yarn.lock . -RUN yarn install --frozen-lockfile --non-interactive - -COPY . . +COPY package.json yarn.lock ./ COPY .env.template .env - -RUN yarn run build CMD ["yarn", "run", "start"] +FROM base as builder +RUN yarn install --frozen-lockfile --non-interactive +COPY . . +RUN yarn run build + # reduce image size with a multistage build -FROM node:10-alpine as production +FROM base as production ENV NODE_ENV=production COPY --from=builder /nitro-backend/dist ./dist -COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile --non-interactive diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 2a5deb170..bed30c3eb 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -2,6 +2,7 @@ version: "3.7" services: backend: + image: humanconnection/nitro-backend:builder build: context: . target: builder