moth/build/package/Containerfile

29 lines
631 B
Plaintext
Raw Normal View History

2020-09-18 17:48:57 -06:00
FROM golang:1 AS builder
2020-09-17 18:56:40 -06:00
COPY go.* /src/
COPY pkg /src/pkg/
COPY cmd /src/cmd/
COPY theme /target/theme/
COPY example-puzzles /target/puzzles/
COPY LICENSE.md /target/
2020-09-18 17:48:57 -06:00
RUN mkdir -p /target/state
2020-09-17 18:56:40 -06:00
WORKDIR /src/
2021-10-19 17:22:11 -06:00
RUN CGO_ENABLED=0 GOOS=linux go install -a -ldflags '-extldflags "-static"' ./...
2020-09-18 17:48:57 -06:00
# I can't use /target/bin: doing so would cause the devel server to overwrite Ubuntu's /bin
2020-09-17 18:56:40 -06:00
##########
FROM builder AS tester
RUN go test -race ./...
2020-09-17 18:56:40 -06:00
##########
2020-09-18 17:48:57 -06:00
FROM builder AS prodbuild
RUN mkdir -p /target/bin
RUN cp /go/bin/* /target/bin/
##########
2020-09-17 18:56:40 -06:00
FROM scratch AS moth
2020-09-18 17:48:57 -06:00
COPY --from=prodbuild /target /
ENTRYPOINT [ "/bin/mothd" ]