mirror of https://github.com/dirtbags/moth.git
31 lines
683 B
Docker
31 lines
683 B
Docker
FROM golang:1 AS builder
|
|
COPY go.* /src/
|
|
COPY pkg /src/pkg/
|
|
COPY cmd /src/cmd/
|
|
COPY theme /target/theme/
|
|
COPY example-puzzles /target/puzzles/
|
|
COPY LICENSE.md /target/
|
|
RUN mkdir -p /target/state
|
|
WORKDIR /src/
|
|
#RUN go get github.com/go-redis/redis/v8
|
|
RUN go get ./...
|
|
RUN CGO_ENABLED=0 GOOS=linux go install -a -ldflags '-extldflags "-static"' ./...
|
|
# I can't use /target/bin: doing so would cause the devel server to overwrite Ubuntu's /bin
|
|
|
|
##########
|
|
|
|
FROM builder AS tester
|
|
RUN go test ./...
|
|
|
|
##########
|
|
|
|
FROM builder AS prodbuild
|
|
RUN mkdir -p /target/bin
|
|
RUN cp /go/bin/* /target/bin/
|
|
|
|
##########
|
|
|
|
FROM scratch AS moth
|
|
COPY --from=prodbuild /target /
|
|
ENTRYPOINT [ "/bin/mothd" ]
|