2022-08-23 06:10:29 -05:00
|
|
|
#syntax=docker/dockerfile:1.2
|
|
|
|
|
2023-03-22 08:12:06 -05:00
|
|
|
FROM golang:1.20-bullseye as build
|
2020-08-28 09:19:47 -05:00
|
|
|
RUN apt-get update && apt-get install -y sqlite3
|
2020-08-20 12:35:04 -05:00
|
|
|
WORKDIR /build
|
|
|
|
|
2022-02-10 03:37:46 -06:00
|
|
|
# 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
|
|
|
|
|
2020-08-20 12:35:04 -05:00
|
|
|
# Utilise Docker caching when downloading dependencies, this stops us needlessly
|
|
|
|
# downloading dependencies every time.
|
2022-11-14 06:06:41 -06:00
|
|
|
ARG CGO
|
2022-08-23 06:10:29 -05:00
|
|
|
RUN --mount=target=. \
|
|
|
|
--mount=type=cache,target=/go/pkg/mod \
|
|
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
2022-11-14 06:06:41 -06:00
|
|
|
CGO_ENABLED=${CGO} go build -o /dendrite ./cmd/generate-config && \
|
|
|
|
CGO_ENABLED=${CGO} go build -o /dendrite ./cmd/generate-keys && \
|
2023-02-14 05:47:47 -06:00
|
|
|
CGO_ENABLED=${CGO} go build -o /dendrite/dendrite ./cmd/dendrite && \
|
2023-03-22 08:12:06 -05:00
|
|
|
CGO_ENABLED=${CGO} go build -cover -covermode=atomic -o /dendrite/dendrite-cover -coverpkg "github.com/matrix-org/..." ./cmd/dendrite && \
|
2022-12-23 07:28:15 -06:00
|
|
|
cp build/scripts/complement-cmd.sh /complement-cmd.sh
|
2022-02-10 03:37:46 -06:00
|
|
|
|
|
|
|
WORKDIR /dendrite
|
2022-02-01 10:36:17 -06:00
|
|
|
RUN ./generate-keys --private-key matrix_key.pem
|
2020-08-20 12:35:04 -05:00
|
|
|
|
|
|
|
ENV SERVER_NAME=localhost
|
2022-03-24 06:52:51 -05:00
|
|
|
ENV API=0
|
2022-12-23 07:28:15 -06:00
|
|
|
ENV COVER=0
|
2020-08-20 12:35:04 -05:00
|
|
|
EXPOSE 8008 8448
|
|
|
|
|
2022-02-01 10:36:17 -06:00
|
|
|
# At runtime, generate TLS cert based on the CA now mounted at /ca
|
|
|
|
# At runtime, replace the SERVER_NAME with what we are told
|
2022-08-23 06:10:29 -05:00
|
|
|
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 && \
|
2022-07-11 08:31:31 -05:00
|
|
|
./generate-config -server $SERVER_NAME --ci > dendrite.yaml && \
|
|
|
|
cp /complement/ca/ca.crt /usr/local/share/ca-certificates/ && update-ca-certificates && \
|
2022-12-23 07:28:15 -06:00
|
|
|
exec /complement-cmd.sh
|