moth/build/package/Containerfile

46 lines
1.0 KiB
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/
RUN CGO_ENABLED=0 GOOS=linux go install -i -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" ]
2020-09-17 18:56:40 -06:00
##########
2020-10-29 13:51:49 -06:00
# You should use the dirtbags/moth-devel repo's build for this, instead
2020-09-17 18:56:40 -06:00
FROM ubuntu AS moth-devel
RUN apt-get -y update && apt-get -y install \
build-essential \
bsdgames \
figlet toilet \
lua5.3 \
2020-09-17 18:56:40 -06:00
python3 \
python3-pil \
python3-scapy \
2020-09-18 17:48:57 -06:00
python3-yaml \
cowsay
2020-09-18 17:48:57 -06:00
COPY --from=builder /target /
COPY --from=builder /go/bin/* /bin/
CMD [ "/bin/mothd", "-puzzles", "/puzzles" ]