Move Birthday Surprise to its own directory and add single platform Dockerfile

This commit is contained in:
Patrick Devine 2019-04-23 11:31:41 -07:00
Родитель efa85a91d5
Коммит 842d9707fc
4 изменённых файлов: 26 добавлений и 6 удалений

Просмотреть файл

@ -1,10 +1,10 @@
FROM golang:alpine3.8 as builder
WORKDIR /project
COPY surprise.go .
FROM golang:1.11-alpine AS builder
RUN apk add --no-cache git
RUN go get github.com/pdevine/go-asciisprite
WORKDIR /project
COPY surprise.go .
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o surprise surprise.go
FROM scratch
COPY --from=builder /project/surprise /surprise
CMD ["/surprise"]
ENTRYPOINT ["/surprise"]

Просмотреть файл

@ -0,0 +1,20 @@
FROM --platform=$BUILDPLATFORM golang:1.11-alpine AS builder
RUN apk add --no-cache git
RUN go get github.com/pdevine/go-asciisprite
WORKDIR /project
COPY surprise.go .
ARG TARGETOS
ARG TARGETARCH
ENV GOOS=$TARGETOS GOARCH=$TARGETARCH
RUN CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o surprise surprise.go
FROM scratch AS release-linux
COPY --from=builder /project/surprise /surprise
ENTRYPOINT ["/surprise"]
FROM microsoft/nanoserver AS release-windows
COPY --from=builder /project/surprise /surprise.exe
ENTRYPOINT ["\\surprise.exe"]
FROM release-$TARGETOS

Просмотреть файл

@ -6,7 +6,7 @@ Happy Birthday, Docker!
March 2019 marks Docker's sixth year, and we thought we'd celebrate it docker-style with a birthday surprise!
To try it out, run:
`docker run -it --rm surprise`
`docker run -it --rm docker/surprise`
Complete source can be found [here](https://github.com/docker/birthday).
Complete source can be found [here](https://github.com/docker/doodle/birthday2019).

Просмотреть файл