2022-11-02 09:04:08 -05:00
|
|
|
#syntax=docker/dockerfile:1.2
|
|
|
|
|
|
|
|
#
|
|
|
|
# base installs required dependencies and runs go mod download to cache dependencies
|
|
|
|
#
|
2024-04-15 01:56:55 -05:00
|
|
|
FROM --platform=${BUILDPLATFORM} docker.io/golang:1.22-alpine AS base
|
2023-07-11 06:56:25 -05:00
|
|
|
RUN apk --update --no-cache add bash build-base curl git
|
2022-11-02 09:04:08 -05:00
|
|
|
|
|
|
|
#
|
|
|
|
# build creates all needed binaries
|
|
|
|
#
|
2022-11-02 09:41:38 -05:00
|
|
|
FROM --platform=${BUILDPLATFORM} base AS build
|
2022-11-02 09:04:08 -05:00
|
|
|
WORKDIR /src
|
|
|
|
ARG TARGETOS
|
|
|
|
ARG TARGETARCH
|
|
|
|
RUN --mount=target=. \
|
|
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
2022-11-04 05:54:53 -05:00
|
|
|
--mount=type=cache,target=/go/pkg/mod \
|
2022-11-02 09:04:08 -05:00
|
|
|
USERARCH=`go env GOARCH` \
|
|
|
|
GOARCH="$TARGETARCH" \
|
|
|
|
GOOS="linux" \
|
|
|
|
CGO_ENABLED=$([ "$TARGETARCH" = "$USERARCH" ] && echo "1" || echo "0") \
|
2023-10-25 06:53:40 -05:00
|
|
|
go build -v -trimpath -o /out/ ./cmd/...
|
2022-11-02 09:04:08 -05:00
|
|
|
|
2023-02-14 05:47:47 -06:00
|
|
|
|
2022-11-02 09:04:08 -05:00
|
|
|
#
|
2023-02-14 05:47:47 -06:00
|
|
|
# Builds the Dendrite image containing all required binaries
|
2022-11-02 09:04:08 -05:00
|
|
|
#
|
2023-02-14 05:47:47 -06:00
|
|
|
FROM alpine:latest
|
2023-01-06 12:49:59 -06:00
|
|
|
RUN apk --update --no-cache add curl
|
2023-02-14 05:47:47 -06:00
|
|
|
LABEL org.opencontainers.image.title="Dendrite"
|
2022-11-02 09:04:08 -05:00
|
|
|
LABEL org.opencontainers.image.description="Next-generation Matrix homeserver written in Go"
|
|
|
|
LABEL org.opencontainers.image.source="https://github.com/matrix-org/dendrite"
|
|
|
|
LABEL org.opencontainers.image.licenses="Apache-2.0"
|
|
|
|
LABEL org.opencontainers.image.documentation="https://matrix-org.github.io/dendrite/"
|
|
|
|
LABEL org.opencontainers.image.vendor="The Matrix.org Foundation C.I.C."
|
|
|
|
|
|
|
|
COPY --from=build /out/create-account /usr/bin/create-account
|
|
|
|
COPY --from=build /out/generate-config /usr/bin/generate-config
|
|
|
|
COPY --from=build /out/generate-keys /usr/bin/generate-keys
|
2023-02-14 05:47:47 -06:00
|
|
|
COPY --from=build /out/dendrite /usr/bin/dendrite
|
2022-11-02 09:04:08 -05:00
|
|
|
|
2022-11-03 03:37:58 -05:00
|
|
|
VOLUME /etc/dendrite
|
|
|
|
WORKDIR /etc/dendrite
|
|
|
|
|
2023-02-14 05:47:47 -06:00
|
|
|
ENTRYPOINT ["/usr/bin/dendrite"]
|
2022-11-02 09:04:08 -05:00
|
|
|
EXPOSE 8008 8448
|
|
|
|
|