dendrite/build/scripts/Complement.Dockerfile
Till f0578a506d
Update deps (#3580)
⚠ This also bumps the required go version to 1.23.0

All in one dependabot updates:
https://github.com/element-hq/dendrite/pull/3507
https://github.com/element-hq/dendrite/pull/3559
https://github.com/element-hq/dendrite/pull/3560
https://github.com/element-hq/dendrite/pull/3561
https://github.com/element-hq/dendrite/pull/3573
https://github.com/element-hq/dendrite/pull/3574
https://github.com/element-hq/dendrite/pull/3575
https://github.com/element-hq/dendrite/pull/3576
https://github.com/element-hq/dendrite/pull/3577
https://github.com/element-hq/dendrite/pull/3579

### Pull Request Checklist

<!-- Please read
https://matrix-org.github.io/dendrite/development/contributing before
submitting your pull request -->

* [ ] I have added Go unit tests or [Complement integration
tests](https://github.com/matrix-org/complement) for this PR _or_ I have
justified why this PR doesn't need tests
* [ ] Pull request includes a [sign off
below](https://element-hq.github.io/dendrite/development/contributing#sign-off)
_or_ I have already signed off privately

Signed-off-by: `Your Name <your@email.example.org>`
2025-05-16 18:52:30 +02:00

36 lines
1.6 KiB
Docker

#syntax=docker/dockerfile:1.2
FROM golang:1.23-bookworm as build
RUN apt-get update && apt-get install -y sqlite3
WORKDIR /build
# we will dump the binaries and config file to this location to ensure any local untracked files
# that come from the COPY . . file don't contaminate the build
RUN mkdir /dendrite
# Utilise Docker caching when downloading dependencies, this stops us needlessly
# downloading dependencies every time.
ARG CGO
RUN --mount=target=. \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=${CGO} go build -o /dendrite ./cmd/generate-config && \
CGO_ENABLED=${CGO} go build -o /dendrite ./cmd/generate-keys && \
CGO_ENABLED=${CGO} go build -o /dendrite/dendrite ./cmd/dendrite && \
CGO_ENABLED=${CGO} go build -cover -covermode=atomic -o /dendrite/dendrite-cover -coverpkg "github.com/matrix-org/..." ./cmd/dendrite && \
cp build/scripts/complement-cmd.sh /complement-cmd.sh
WORKDIR /dendrite
RUN ./generate-keys --private-key matrix_key.pem
ENV SERVER_NAME=localhost
ENV API=0
ENV COVER=0
EXPOSE 8008 8448
# At runtime, generate TLS cert based on the CA now mounted at /ca
# At runtime, replace the SERVER_NAME with what we are told
CMD ./generate-keys -keysize 1024 --server $SERVER_NAME --tls-cert server.crt --tls-key server.key --tls-authority-cert /complement/ca/ca.crt --tls-authority-key /complement/ca/ca.key && \
./generate-config -server $SERVER_NAME --ci > dendrite.yaml && \
cp /complement/ca/ca.crt /usr/local/share/ca-certificates/ && update-ca-certificates && \
exec /complement-cmd.sh