moth/build/package/Containerfile

40 lines
858 B
Plaintext
Raw Normal View History

2020-09-18 15:55:11 -06:00
FROM golang:1-alpine 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/
WORKDIR /src/
RUN CGO_ENABLED=0 GOOS=linux go install -i -a -ldflags '-extldflags "-static"' ./...
# I can't put these in /target/bin: doing so would cause the devel server to overwrite Ubuntu's /bin
RUN mkdir -p /target/bin/
RUN cp /go/bin/* /target/
##########
FROM builder AS tester
RUN go test ./...
##########
FROM scratch AS moth
COPY --from=builder /target /
ENTRYPOINT [ "/mothd" ]
##########
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 \
cowsay
2020-09-17 18:56:40 -06:00
COPY --from=builder /bin/* /
CMD [ "/mothd", "-puzzles", "/puzzles" ]