This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/Dockerfile

51 lines
1.1 KiB
Docker
Raw Normal View History

# syntax=docker/dockerfile:1.2
ARG APP_PATH=/opt/outline
FROM node:14-alpine AS deps-common
2017-12-05 18:42:52 +00:00
ARG APP_PATH
2017-12-05 18:42:52 +00:00
WORKDIR $APP_PATH
COPY ./package.json ./yarn.lock ./
# ---
FROM deps-common AS deps-dev
RUN yarn install --no-optional --frozen-lockfile && \
yarn cache clean
2019-05-20 00:49:51 +00:00
# ---
FROM deps-common AS deps-prod
RUN yarn install --production=true --frozen-lockfile && \
yarn cache clean
2020-09-05 19:44:40 +00:00
# ---
FROM node:14-alpine AS builder
ARG APP_PATH
WORKDIR $APP_PATH
2020-09-05 19:44:40 +00:00
COPY . .
COPY --from=deps-dev $APP_PATH/node_modules ./node_modules
RUN yarn build
2017-12-05 18:42:52 +00:00
# ---
FROM node:14-alpine AS runner
2020-09-05 19:44:40 +00:00
ARG APP_PATH
WORKDIR $APP_PATH
2020-09-05 19:44:40 +00:00
ENV NODE_ENV production
COPY --from=builder $APP_PATH/build ./build
COPY --from=builder $APP_PATH/server ./server
COPY --from=builder $APP_PATH/public ./public
COPY --from=builder $APP_PATH/.sequelizerc ./.sequelizerc
COPY --from=deps-prod $APP_PATH/node_modules ./node_modules
COPY --from=builder $APP_PATH/package.json ./package.json
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001 && \
chown -R nodejs:nodejs $APP_PATH/build
USER nodejs
2019-07-29 18:48:26 +00:00
EXPOSE 3000
CMD ["yarn", "start"]