Ocelot-Social/backend/Dockerfile
Wolfgang Huß d2d257bc1c Merge branch 'master' of https://github.com/Ocelot-Social-Community/Ocelot-Social into white-labeling
# Conflicts:
#	backend/Dockerfile
#	webapp/Dockerfile
#	webapp/Dockerfile.maintenance
#	webapp/components/LoginForm/LoginForm.vue
#	webapp/package.json
2020-12-02 11:11:26 +01:00

29 lines
917 B
Docker

FROM node:15.3.0-alpine3.10 as base
LABEL Description="Backend of the Social Network ocelot.social" Vendor="ocelot.social Community" Version="0.0.1" Maintainer="ocelot.social Community (devops@ocelot.social)"
EXPOSE 4000
CMD ["yarn", "run", "start"]
ARG BUILD_COMMIT
ENV BUILD_COMMIT=$BUILD_COMMIT
ARG WORKDIR=/develop-backend
RUN mkdir -p $WORKDIR
WORKDIR $WORKDIR
RUN apk --no-cache add git
COPY package.json yarn.lock ./
COPY .env.template .env
FROM base as build-and-test
RUN yarn install --production=false --frozen-lockfile --non-interactive
COPY . .
RUN NODE_ENV=production yarn run build
# reduce image size with a multistage build
FROM base as production
ENV NODE_ENV=production
COPY --from=build-and-test /develop-backend/dist ./dist
COPY ./public/img/ ./public/img/
COPY ./public/providers.json ./public/providers.json
RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache