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