Files
ThreadNet-Web/apps/web/Dockerfile
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
1.9 KiB
Docker
Raw Normal View History

# syntax=docker.io/docker/dockerfile:1.24-labs@sha256:7d49dad25a050e14338ba7028b0460243f9d911dedc160a8fe20c34738fef3af
2026-03-20 14:26:32 +01:00
# Context must be the root of the monorepo
# Builder
2026-05-21 17:47:34 +01:00
FROM --platform=$BUILDPLATFORM node:24-bullseye@sha256:44aeb8a19d0a201cdcb18ea3b25de9249454e6fc3cd05731584659859022fefb AS builder
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"
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-02-11 10:35:29 +00:00
RUN corepack enable
2026-03-20 14:26:32 +01:00
RUN --mount=type=bind,source=.git,target=/src/.git /src/scripts/docker-link-repos.sh
RUN pnpm install --frozen-lockfile
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
# App
FROM nginxinc/nginx-unprivileged:alpine-slim@sha256:01cb6604af2fd0dce17f7aab60759e47ad288bec0425ad4b43e749369d2eecca
# Need root user to install packages & manipulate the usr directory
USER root
# 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
# 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
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 22:54:52 +00:00
# Run as nginx user by default
USER nginx
# 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