2022-01-05 17:44:49 +00:00
|
|
|
FROM golang:1.16-stretch as build
|
2020-08-28 14:19:47 +00:00
|
|
|
RUN apt-get update && apt-get install -y sqlite3
|
2020-08-20 17:35:04 +00:00
|
|
|
WORKDIR /build
|
|
|
|
|
2022-02-10 09:37:46 +00: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 17:35:04 +00:00
|
|
|
# Utilise Docker caching when downloading dependencies, this stops us needlessly
|
|
|
|
# downloading dependencies every time.
|
|
|
|
COPY go.mod .
|
|
|
|
COPY go.sum .
|
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
COPY . .
|
2022-02-10 09:37:46 +00:00
|
|
|
RUN go build -o /dendrite ./cmd/dendrite-monolith-server
|
|
|
|
RUN go build -o /dendrite ./cmd/generate-keys
|
|
|
|
RUN go build -o /dendrite ./cmd/generate-config
|
|
|
|
|
|
|
|
WORKDIR /dendrite
|
2022-02-01 16:36:17 +00:00
|
|
|
RUN ./generate-keys --private-key matrix_key.pem
|
2020-08-20 17:35:04 +00:00
|
|
|
|
|
|
|
ENV SERVER_NAME=localhost
|
2022-03-24 11:52:51 +00:00
|
|
|
ENV API=0
|
2020-08-20 17:35:04 +00:00
|
|
|
EXPOSE 8008 8448
|
|
|
|
|
2022-02-01 16:36:17 +00: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-02-10 18:12:11 +00:00
|
|
|
CMD ./generate-keys --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-02-01 16:36:17 +00:00
|
|
|
./generate-config -server $SERVER_NAME --ci > dendrite.yaml && \
|
2022-02-10 18:12:11 +00:00
|
|
|
cp /complement/ca/ca.crt /usr/local/share/ca-certificates/ && update-ca-certificates && \
|
2022-04-29 07:31:11 +00:00
|
|
|
./dendrite-monolith-server --really-enable-open-registration --tls-cert server.crt --tls-key server.key --config dendrite.yaml -api=${API:-0}
|