mirror of https://github.com/dirtbags/moth.git
46 lines
1.0 KiB
Docker
46 lines
1.0 KiB
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 CGO_ENABLED=0 GOOS=linux go install -i -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" ]
|
|
|
|
##########
|
|
# You should use the dirtbags/moth-devel repo's build for this, instead
|
|
FROM ubuntu AS moth-devel
|
|
RUN apt-get -y update && apt-get -y install \
|
|
build-essential \
|
|
bsdgames \
|
|
figlet toilet \
|
|
lua5.3 \
|
|
python3 \
|
|
python3-pil \
|
|
python3-scapy \
|
|
python3-yaml \
|
|
cowsay
|
|
COPY --from=builder /target /
|
|
COPY --from=builder /go/bin/* /bin/
|
|
CMD [ "/bin/mothd", "-puzzles", "/puzzles" ]
|