1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-19 00:26:27 +03:00
Files
authentication-service/tools/syn2mas/Dockerfile
Hugh Nimmo-Smith 89145d574b Package and publish syn2mas to npm (#2023)
Co-authored-by: Quentin Gliech <quenting@element.io>
2023-11-02 11:56:40 +01:00

49 lines
1.2 KiB
Docker

# Build Node.js app
FROM --platform=${BUILDPLATFORM} docker.io/library/node:18-bookworm AS builder
WORKDIR /syn2mas
COPY ./package.json ./package-lock.json ./tsconfig.json ./
COPY ./src ./src
RUN --network=default \
npm ci
# Install the production dependencies for each architecture we support
FROM --platform=${BUILDPLATFORM} docker.io/library/node:18-bookworm AS deps
WORKDIR /deps/arm64
COPY ./package.json ./package-lock.json ./
# Remove the "prepare" script to avoid compiling typescript
RUN sed -i '/"prepare"/d' package.json
RUN --network=default \
npm ci \
--target_arch=amd64 \
--target_platform=linux \
--omit=dev
WORKDIR /deps/amd64
COPY ./package.json ./package-lock.json ./
# Remove the "prepare" script to avoid compiling typescript
RUN sed -i '/"prepare"/d' package.json
RUN --network=default \
npm ci \
--target_arch=x64 \
--target_platform=linux \
--omit=dev
# Runtime stage
FROM --platform=${TARGETPLATFORM} gcr.io/distroless/nodejs18-debian12:debug-nonroot
WORKDIR /syn2mas
COPY ./package.json ./package-lock.json ./
COPY --from=builder /syn2mas/dist ./dist
ARG TARGETARCH
COPY --from=deps /deps/${TARGETARCH}/node_modules ./node_modules
ENTRYPOINT ["/nodejs/bin/node", "dist/index.js"]