2022-07-25 10:36:28 -04:00
|
|
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: CC-BY-SA-4.0
|
|
|
|
|
|
|
|
# BUILD
|
2022-07-31 14:31:33 -04:00
|
|
|
FROM node:18-alpine AS builder
|
2022-09-16 05:03:29 -04:00
|
|
|
ENV NODE_ENV=production
|
2022-07-25 10:36:28 -04:00
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
2022-09-16 05:03:29 -04:00
|
|
|
ARG BUILD_VERSION=CLIENT_VERSION_MISSING
|
2022-07-25 10:36:28 -04:00
|
|
|
|
2022-07-31 14:31:33 -04:00
|
|
|
WORKDIR /app
|
2022-11-11 04:44:19 -05:00
|
|
|
COPY --chown=node .yarn ../.yarn
|
|
|
|
COPY --chown=node frontend ./
|
2022-09-16 05:03:29 -04:00
|
|
|
RUN rm -rf public/public && \
|
|
|
|
rm -rf src/pages/api && \
|
|
|
|
yarn install --immutable && \
|
2022-08-30 06:28:53 -04:00
|
|
|
sed -i "s/CLIENT_VERSION_MISSING/${BUILD_VERSION}/" src/version.json && \
|
2022-09-16 05:03:29 -04:00
|
|
|
yarn build
|
2022-07-25 10:36:28 -04:00
|
|
|
|
|
|
|
# RUNNER
|
2022-07-31 14:31:33 -04:00
|
|
|
FROM node:18-alpine
|
2022-07-25 10:36:28 -04:00
|
|
|
ENV NODE_ENV=production
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
|
|
|
|
WORKDIR /app
|
2022-07-31 14:31:33 -04:00
|
|
|
|
2022-08-01 08:00:04 -04:00
|
|
|
COPY --from=builder /app/next.config.js ./
|
|
|
|
COPY --from=builder /app/public ./public
|
2022-07-31 14:31:33 -04:00
|
|
|
COPY --from=builder --chown=node:node /app/.next/static ./.next/static
|
2022-08-01 08:00:04 -04:00
|
|
|
COPY --from=builder --chown=node:node /app/.next/standalone ./
|
2022-07-31 14:31:33 -04:00
|
|
|
|
2022-07-25 10:36:28 -04:00
|
|
|
USER node
|
|
|
|
|
2022-09-16 05:03:29 -04:00
|
|
|
ENV PORT 3001
|
|
|
|
EXPOSE 3001/tcp
|
2022-07-31 14:31:33 -04:00
|
|
|
CMD ["node", "server.js"]
|