moth

Monarch Of The Hill game server
git clone https://git.woozle.org/neale/moth.git

moth / build / package
Neale Pickett  ·  2023-12-06

Containerfile

 1ARG GO_VERSION=1.21-alpine
 2FROM docker.io/library/golang:${GO_VERSION} AS builder
 3COPY go.* /src/
 4COPY pkg /src/pkg/
 5COPY cmd /src/cmd/
 6COPY theme /target/theme/
 7COPY example-puzzles /target/puzzles/
 8COPY LICENSE.md /target/
 9RUN mkdir -p /target/state
10WORKDIR /src/
11RUN CGO_ENABLED=0 GOOS=linux go install -a -ldflags '-extldflags "-static"' ./...
12# I can't use /target/bin: doing so would cause the devel server to overwrite Ubuntu's /bin
13
14##########
15
16FROM builder AS tester
17RUN go test ./...
18
19##########
20
21FROM builder AS prodbuild
22RUN mkdir -p /target/bin
23RUN cp /go/bin/* /target/bin/
24
25##########
26
27FROM scratch AS moth
28COPY --from=prodbuild /target /
29ENTRYPOINT [ "/bin/mothd" ]