2026-06-18 10:41:17 +01:00
|
|
|
# syntax=docker.io/docker/dockerfile:1.25-labs@sha256:4426b5e269e36911b94fb79cf67f1fd7155ef11b2bbc8ab23cbfcbc97130efe9
|
2026-03-20 14:26:32 +01:00
|
|
|
# Context must be the root of the monorepo
|
2025-02-24 16:54:57 +00:00
|
|
|
|
2026-07-09 16:48:27 +01:00
|
|
|
# PNPM source
|
2026-07-10 09:20:47 +01:00
|
|
|
FROM ghcr.io/pnpm/pnpm:11.10.0@sha256:9a6eb06d5f861d830fe27d85a91415e60527fa45ec45b52ee43c92a8aaf3bf8a AS pnpm
|
2026-07-09 16:48:27 +01:00
|
|
|
|
2018-12-04 16:00:16 +01:00
|
|
|
# Builder
|
2026-06-30 15:21:42 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM node:24-bullseye@sha256:b2f4f5e6553256d611490b757e7aa80da1faae9d264d77ac8c2ddca96ace9d68 AS builder
|
2018-12-04 16:00:16 +01:00
|
|
|
|
2026-07-09 16:48:27 +01:00
|
|
|
COPY --from=pnpm /opt/pnpm /opt/pnpm
|
|
|
|
|
RUN ln -s /opt/pnpm/pnpm /usr/local/bin/pnpm
|
|
|
|
|
|
2024-10-15 14:57:26 +01:00
|
|
|
# Support custom branch of the js-sdk. This also helps us build images of element-web develop.
|
2019-04-10 15:47:02 -06:00
|
|
|
ARG USE_CUSTOM_SDKS=false
|
|
|
|
|
ARG JS_SDK_REPO="https://github.com/matrix-org/matrix-js-sdk.git"
|
|
|
|
|
ARG JS_SDK_BRANCH="master"
|
|
|
|
|
|
2018-12-04 16:00:16 +01:00
|
|
|
WORKDIR /src
|
|
|
|
|
|
2026-03-20 14:26:32 +01:00
|
|
|
# Install dependencies
|
|
|
|
|
COPY --parents package.json pnpm-lock.yaml pnpm-workspace.yaml patches scripts **/package.json /src/
|
2026-04-30 14:15:55 +01:00
|
|
|
RUN pnpm install --frozen-lockfile
|
2026-06-08 17:26:14 +01:00
|
|
|
RUN --mount=type=bind,source=.git,target=/src/.git /src/scripts/docker-link-repos.sh
|
2026-03-20 14:26:32 +01:00
|
|
|
|
|
|
|
|
# Build
|
|
|
|
|
COPY --link --exclude=.git --exclude=apps/web/docker . /src
|
|
|
|
|
RUN --mount=type=bind,source=.git,target=/src/.git /src/scripts/docker-package.sh
|
2019-04-10 15:47:02 -06:00
|
|
|
|
|
|
|
|
# Copy the config now so that we don't create another layer in the app image
|
2026-02-24 16:11:24 +00:00
|
|
|
RUN cp /src/apps/web/config.sample.json /src/apps/web/webapp/config.json
|
2018-12-04 16:00:16 +01:00
|
|
|
|
|
|
|
|
# App
|
2026-06-30 15:46:33 +01:00
|
|
|
FROM nginxinc/nginx-unprivileged:alpine-slim@sha256:ee7751c78fd1a51a8c12ac5a0ab15b2de2d486df155ef95bf52db9cef7de0d2d
|
2025-03-27 16:43:13 -04:00
|
|
|
|
|
|
|
|
# Need root user to install packages & manipulate the usr directory
|
|
|
|
|
USER root
|
2018-12-04 16:00:16 +01:00
|
|
|
|
2025-02-24 16:54:57 +00:00
|
|
|
# Install jq and moreutils for sponge, both used by our entrypoints
|
|
|
|
|
RUN apk add jq moreutils
|
|
|
|
|
|
2026-02-24 16:11:24 +00:00
|
|
|
COPY --from=builder /src/apps/web/webapp /app
|
2018-12-04 16:00:16 +01:00
|
|
|
|
2025-01-03 11:46:12 +00:00
|
|
|
# Override default nginx config. Templates in `/etc/nginx/templates` are passed
|
|
|
|
|
# through `envsubst` by the nginx docker image entry point.
|
2026-02-24 16:11:24 +00:00
|
|
|
COPY /apps/web/docker/nginx-templates/* /etc/nginx/templates/
|
|
|
|
|
COPY /apps/web/docker/docker-entrypoint.d/* /docker-entrypoint.d/
|
2021-09-28 12:15:34 +01:00
|
|
|
|
2018-12-04 16:00:16 +01:00
|
|
|
RUN rm -rf /usr/share/nginx/html \
|
2021-06-23 15:42:30 +03:00
|
|
|
&& ln -s /app /usr/share/nginx/html
|
2025-01-03 11:46:12 +00:00
|
|
|
|
2025-01-03 22:54:52 +00:00
|
|
|
# Run as nginx user by default
|
|
|
|
|
USER nginx
|
|
|
|
|
|
2025-01-03 11:46:12 +00:00
|
|
|
# HTTP listen port
|
|
|
|
|
ENV ELEMENT_WEB_PORT=80
|
2025-02-25 09:16:22 +00:00
|
|
|
|
2025-03-11 18:04:33 +00:00
|
|
|
HEALTHCHECK --start-period=5s CMD wget -q --spider http://localhost:$ELEMENT_WEB_PORT/config.json
|