mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 00:51:17 -08:00
upstream/dev added the element-call submodule as a file: dependency (@element-hq/element-call-embedded) but the Dockerfile had no step to build it, causing the vite static-copy plugin to fail with: No file was found to copy on node_modules/@element-hq/element-call-embedded/dist/* Add a new element-call-builder stage that: - Fetches the pinned submodule commit with --depth=1 - Enables corepack to activate yarn 4.x (required by packageManager field) - Runs yarn build:embedded to produce embedded/web/dist/ The builder stage then COPYs the pre-built package into place before npm ci, so npm can resolve the file: dep and vite finds the assets.
51 lines
1.5 KiB
Docker
51 lines
1.5 KiB
Docker
## Element Call embedded build
|
|
FROM --platform=$BUILDPLATFORM node:24.13.1-alpine AS element-call-builder
|
|
|
|
RUN apk add --no-cache git
|
|
|
|
WORKDIR /element-call
|
|
|
|
ARG ELEMENT_CALL_COMMIT=ecef381c246c177af28b8c99c5076da19878a136
|
|
RUN git init && \
|
|
git remote add origin https://github.com/melogale/element-call.git && \
|
|
git fetch --depth=1 origin ${ELEMENT_CALL_COMMIT} && \
|
|
git checkout FETCH_HEAD
|
|
|
|
RUN corepack enable && yarn install && yarn build:embedded
|
|
|
|
## Builder
|
|
FROM --platform=$BUILDPLATFORM node:24.13.1-alpine AS builder
|
|
|
|
WORKDIR /src
|
|
|
|
ARG VITE_BUILD_HASH
|
|
ARG VITE_IS_RELEASE_TAG=false
|
|
ENV VITE_BUILD_HASH=$VITE_BUILD_HASH
|
|
ENV VITE_IS_RELEASE_TAG=$VITE_IS_RELEASE_TAG
|
|
|
|
# Copy the pre-built element-call embedded package so npm ci can resolve the
|
|
# file: dependency and vite can find the dist/ assets to copy.
|
|
COPY --from=element-call-builder /element-call/embedded/web /src/element-call/embedded/web
|
|
|
|
COPY .npmrc package.json package-lock.json /src/
|
|
RUN npm ci --ignore-scripts
|
|
COPY . /src/
|
|
ENV NODE_OPTIONS=--max_old_space_size=4096
|
|
RUN npm run build
|
|
|
|
## Dist
|
|
FROM scratch AS site-dist
|
|
COPY --from=builder /src/dist /
|
|
|
|
## App
|
|
FROM caddy:2-alpine
|
|
|
|
# Strip the file capability set by the base image (cap_net_bind_service=+ep).
|
|
# With --cap-drop=ALL the bounding set is empty, and the kernel refuses to exec
|
|
# any binary that has file capabilities not present in the bounding set — even
|
|
# if those capabilities aren't actually needed at runtime (we listen on :8080).
|
|
RUN setcap -r /usr/bin/caddy
|
|
|
|
COPY --from=site-dist / /app
|
|
COPY Caddyfile /etc/caddy/Caddyfile
|