mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
305b6f5910
Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de> Co-authored-by: David Mehren <git@herrmehren.de> Co-authored-by: Erik Michelson <github@erik.michelson.eu> Signed-off-by: Erik Michelson <github@erik.michelson.eu> Signed-off-by: David Mehren <git@herrmehren.de> Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
53 lines
1.5 KiB
Docker
53 lines
1.5 KiB
Docker
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
#
|
|
# SPDX-License-Identifier: CC-BY-SA-4.0
|
|
|
|
# BASE
|
|
FROM docker.io/node:18-alpine@sha256:bc329c7332cffc30c2d4801e38df03cbfa8dcbae2a7a52a449db104794f168a3 AS base
|
|
RUN apk add --no-cache tini
|
|
ENTRYPOINT ["tini", "--"]
|
|
|
|
# BUILD
|
|
FROM base AS builder
|
|
|
|
RUN apk add --no-cache libc6-compat
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ARG BUILD_VERSION=CLIENT_VERSION_MISSING
|
|
|
|
ENV YARN_CACHE_FOLDER /tmp/.yarn
|
|
USER node
|
|
WORKDIR /usr/src/app
|
|
|
|
COPY --chown=node . .
|
|
RUN --mount=type=cache,sharing=locked,uid=1000,gid=1000,target=/tmp/.yarn \
|
|
yarn install --immutable && yarn workspaces focus hedgedoc @hedgedoc/backend @hedgedoc/commons
|
|
|
|
ARG TURBO_TEAM
|
|
ARG TURBO_API
|
|
ARG TURBO_TOKEN
|
|
|
|
RUN rm -rf frontend/public/public
|
|
RUN rm -rf frontend/src/pages/api
|
|
RUN sed -i "s/CLIENT_VERSION_MISSING/${BUILD_VERSION}/" frontend/src/version.json
|
|
RUN yarn turbo run build --filter=frontend --no-cache --no-daemon
|
|
|
|
# RUNNER
|
|
FROM base
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
COPY --from=builder --chown=node:node /usr/src/app/frontend/.next/standalone ./
|
|
COPY --from=builder --chown=node:node /usr/src/app/frontend/.next/static ./frontend/.next/static
|
|
COPY --from=builder /usr/src/app/frontend/next.config.js ./frontend/next.config.js
|
|
COPY --from=builder /usr/src/app/frontend/public ./frontend/public
|
|
|
|
USER node
|
|
|
|
ENV PORT 3001
|
|
EXPOSE 3001/tcp
|
|
|
|
WORKDIR /usr/src/app/frontend
|
|
CMD ["node", "server.js"]
|