2025-05-28 16:31:45 +00:00
|
|
|
# syntax=docker.io/docker/dockerfile:1.16-labs@sha256:bb5e2b225985193779991f3256d1901a0b3e6a0b284c7bffa0972064f4a6d458
|
2025-02-24 16:54:57 +00:00
|
|
|
|
2018-12-04 16:00:16 +01:00
|
|
|
# Builder
|
2025-05-28 15:30:22 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM node:22-bullseye@sha256:f16d8e8af67bb6361231e932b8b3e7afa040cbfed181719a450b02c3821b26c1 AS builder
|
2018-12-04 16:00:16 +01:00
|
|
|
|
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
|
|
|
|
2019-04-10 15:47:02 -06:00
|
|
|
WORKDIR /src
|
2018-12-06 10:00:20 +01:00
|
|
|
|
2025-02-24 16:54:57 +00:00
|
|
|
COPY --exclude=docker . /src
|
2025-01-02 13:50:17 +00:00
|
|
|
RUN /src/scripts/docker-link-repos.sh
|
2023-05-16 09:43:02 +01:00
|
|
|
RUN yarn --network-timeout=200000 install
|
2025-01-02 13:50:17 +00:00
|
|
|
RUN /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
|
|
|
|
|
RUN cp /src/config.sample.json /src/webapp/config.json
|
2018-12-04 16:00:16 +01:00
|
|
|
|
|
|
|
|
# App
|
2025-05-28 17:23:04 +01:00
|
|
|
FROM nginxinc/nginx-unprivileged:alpine-slim@sha256:2acffd86b1bdefb8fa6b48b6e9aadf75430e8ab9c43c54c515ea7df77897f987
|
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
|
|
|
|
|
|
2018-12-04 16:00:16 +01:00
|
|
|
COPY --from=builder /src/webapp /app
|
|
|
|
|
|
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.
|
|
|
|
|
COPY /docker/nginx-templates/* /etc/nginx/templates/
|
2025-02-24 16:54:57 +00:00
|
|
|
COPY /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
|