Build docker image containing modules (#34657)
Switch to bake to simplify the building of 2 images
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
ARG ELEMENT_VERSION=latest@sha256:9f9b546280e67e492d56f6e775c449e74356bffb98daaf211abc755276713fad
|
||||
|
||||
FROM --platform=$BUILDPLATFORM node:lts-alpine@sha256:f70403e87646dc51b45295f4b8b70cdad0b63d2297c4c9899119b03f7af7a6b3 AS builder
|
||||
|
||||
ARG BUILD_CONTEXT
|
||||
|
||||
RUN apk add --no-cache jq
|
||||
|
||||
WORKDIR /app
|
||||
COPY package.json yarn.lock ./
|
||||
# Copy the package.json files of all modules & packages to ensure the frozen workspace lockfile holds up
|
||||
RUN --mount=type=bind,target=/docker-context \
|
||||
cd /docker-context/; \
|
||||
find . -path ./node_modules -prune -o -name "package.json" -mindepth 0 -maxdepth 4 -exec cp --parents "{}" /app/ \;
|
||||
RUN yarn install --frozen-lockfile --ignore-scripts
|
||||
COPY tsconfig.json ./
|
||||
COPY ./$BUILD_CONTEXT ./$BUILD_CONTEXT
|
||||
RUN cd $BUILD_CONTEXT && yarn vite build
|
||||
RUN mkdir /modules
|
||||
RUN cp -r ./$BUILD_CONTEXT/lib/ /modules/$(jq -r '"\(.name)-v\(.version)"' ./$BUILD_CONTEXT/package.json)
|
||||
|
||||
FROM ghcr.io/element-hq/element-web:${ELEMENT_VERSION}
|
||||
|
||||
COPY --from=builder /modules /modules/
|
||||
Reference in New Issue
Block a user