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-12-10 15:20:31 -07:00
|
|
|
#RUN go get github.com/go-redis/redis/v8
|
|
|
|
RUN go get ./...
|
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 ./...
|
|
|
|
|
|
|
|
##########
|
|
|
|
|
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" ]
|