Fix (?) the build with an image tag for builder

Also I added a base stage so we can have a common working directory.
This commit is contained in:
Robert Schäfer 2018-12-14 23:10:48 +01:00
parent bef8aa1d6a
commit 4e816d9020
2 changed files with 9 additions and 14 deletions

View File

@ -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

View File

@ -2,6 +2,7 @@ version: "3.7"
services:
backend:
image: humanconnection/nitro-backend:builder
build:
context: .
target: builder