hedgedoc/Dockerfile
Erik Michelson a3c74e7310 feat(docker): add build version to built images
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2022-08-30 16:11:26 +02:00

32 lines
780 B
Docker

# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
#
# SPDX-License-Identifier: CC-BY-SA-4.0
# BUILD
FROM node:18-alpine AS builder
ARG BUILD_VERSION=CLIENT_VERSION_MISSING
ENV NEXT_TELEMETRY_DISABLED=1
WORKDIR /app
COPY . ./
RUN yarn install --immutable && \
sed -i "s/CLIENT_VERSION_MISSING/${BUILD_VERSION}/" src/version.json && \
yarn build:for-real-backend
# RUNNER
FROM node:18-alpine
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
WORKDIR /app
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder --chown=node:node /app/.next/static ./.next/static
COPY --from=builder --chown=node:node /app/.next/standalone ./
USER node
ENV PORT 3000
EXPOSE 3000/tcp
CMD ["node", "server.js"]