FROM docker.io/golang:1.15-alpine AS base

RUN apk --update --no-cache add bash build-base

WORKDIR /build

COPY . /build

RUN mkdir -p bin
RUN go build -trimpath -o bin/ ./cmd/dendrite-monolith-server
RUN go build -trimpath -o bin/ ./cmd/goose
RUN go build -trimpath -o bin/ ./cmd/create-account
RUN go build -trimpath -o bin/ ./cmd/generate-keys

FROM alpine:latest

COPY --from=base /build/bin/* /usr/bin

VOLUME /etc/dendrite
WORKDIR /etc/dendrite

ENTRYPOINT ["/usr/bin/dendrite-monolith-server"]