2022-11-02 15:24:45 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: CC-BY-SA-4.0
|
|
|
|
|
2022-12-11 23:46:30 +00:00
|
|
|
# BASE
|
2023-03-04 06:16:08 +00:00
|
|
|
FROM docker.io/node:18-alpine@sha256:f8a51c36b0be7434bbf867d4a08decf0100e656203d893b9b0f8b1fe9e40daea AS base
|
2022-12-11 23:46:30 +00:00
|
|
|
RUN apk add --no-cache tini
|
|
|
|
ENTRYPOINT ["tini", "--"]
|
|
|
|
|
2022-11-02 15:24:45 +00:00
|
|
|
# BUILD
|
2022-12-11 23:46:30 +00:00
|
|
|
FROM base AS builder
|
|
|
|
|
|
|
|
RUN apk add --no-cache libc6-compat
|
2022-11-02 15:24:45 +00:00
|
|
|
ENV NODE_ENV=production
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
ARG BUILD_VERSION=CLIENT_VERSION_MISSING
|
|
|
|
|
2023-03-02 20:18:13 +00:00
|
|
|
ENV YARN_CACHE_FOLDER=/tmp/.yarn
|
2022-11-02 15:24:45 +00:00
|
|
|
USER node
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
2022-12-11 23:46:30 +00:00
|
|
|
COPY --chown=node . .
|
2022-11-02 15:24:45 +00:00
|
|
|
RUN --mount=type=cache,sharing=locked,uid=1000,gid=1000,target=/tmp/.yarn \
|
2023-02-07 21:03:24 +00:00
|
|
|
yarn install --immutable
|
2022-12-04 21:42:39 +00:00
|
|
|
|
2022-12-11 23:46:30 +00:00
|
|
|
ARG TURBO_TEAM
|
|
|
|
ARG TURBO_API
|
|
|
|
ARG TURBO_TOKEN
|
2022-11-02 15:24:45 +00:00
|
|
|
|
2022-12-11 23:46:30 +00:00
|
|
|
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
|
2022-11-02 15:24:45 +00:00
|
|
|
|
|
|
|
# RUNNER
|
2022-12-11 23:46:30 +00:00
|
|
|
FROM base
|
2022-11-02 15:24:45 +00:00
|
|
|
ENV NODE_ENV=production
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
|
2023-02-21 11:54:07 +00:00
|
|
|
LABEL org.opencontainers.image.title='HedgeDoc production frontend image'
|
|
|
|
LABEL org.opencontainers.image.url='https://hedgedoc.org'
|
|
|
|
LABEL org.opencontainers.image.source='https://github.com/hedgedoc/hedgedoc'
|
|
|
|
LABEL org.opencontainers.image.documentation='https://github.com/hedgedoc/hedgedoc/blob/develop/docs/content/dev/docker.md'
|
|
|
|
LABEL org.opencontainers.image.licenses='AGPL-3.0'
|
|
|
|
|
2022-11-02 15:24:45 +00:00
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
COPY --from=builder --chown=node:node /usr/src/app/frontend/.next/standalone ./
|
2023-02-04 13:44:57 +00:00
|
|
|
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
|
2022-11-02 15:24:45 +00:00
|
|
|
|
|
|
|
USER node
|
|
|
|
|
|
|
|
ENV PORT 3001
|
|
|
|
EXPOSE 3001/tcp
|
2023-02-04 13:44:57 +00:00
|
|
|
|
|
|
|
WORKDIR /usr/src/app/frontend
|
|
|
|
CMD ["node", "server.js"]
|