-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDockerfile
36 lines (34 loc) · 2.31 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM golang:alpine AS builder
LABEL stage=builder
COPY main.go /go/src/github.com/pygmystack/pygmy/
COPY go.sum /go/src/github.com/pygmystack/pygmy/
COPY go.mod /go/src/github.com/pygmystack/pygmy/
COPY cmd/ /go/src/github.com/pygmystack/pygmy/cmd/
COPY internal/ /go/src/github.com/pygmystack/pygmy/internal/
COPY external/ /go/src/github.com/pygmystack/pygmy/external/
WORKDIR /go/src/github.com/pygmystack/pygmy/
RUN GO111MODULE=on go mod verify
RUN GO111MODULE=on GOOS=linux GOARCH=386 go build -o pygmy-linux-386 .
RUN GO111MODULE=on GOOS=linux GOARCH=386 CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o pygmy-linux-386-static .
RUN GO111MODULE=on GOOS=linux GOARCH=arm go build -o pygmy-linux-arm .
RUN GO111MODULE=on GOOS=linux GOARCH=arm CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o pygmy-linux-arm-static .
RUN GO111MODULE=on GOOS=linux GOARCH=arm64 go build -o pygmy-linux-arm64 .
RUN GO111MODULE=on GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o pygmy-linux-arm64-static .
RUN GO111MODULE=on GOOS=linux GOARCH=amd64 go build -o pygmy-linux-amd64 .
RUN GO111MODULE=on GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o pygmy-linux-amd64-static .
RUN GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -o pygmy-darwin-amd64 .
RUN GO111MODULE=on GOOS=darwin GOARCH=arm64 go build -o pygmy-darwin-arm64 .
RUN GO111MODULE=on GOOS=windows GOARCH=amd64 go build -o pygmy.exe .
FROM alpine
WORKDIR /app
COPY --from=builder /go/src/github.com/pygmystack/pygmy/pygmy-linux-386 .
COPY --from=builder /go/src/github.com/pygmystack/pygmy/pygmy-linux-386-static .
COPY --from=builder /go/src/github.com/pygmystack/pygmy/pygmy-linux-arm .
COPY --from=builder /go/src/github.com/pygmystack/pygmy/pygmy-linux-arm-static .
COPY --from=builder /go/src/github.com/pygmystack/pygmy/pygmy-linux-arm64 .
COPY --from=builder /go/src/github.com/pygmystack/pygmy/pygmy-linux-arm64-static .
COPY --from=builder /go/src/github.com/pygmystack/pygmy/pygmy-linux-amd64 .
COPY --from=builder /go/src/github.com/pygmystack/pygmy/pygmy-linux-amd64-static .
COPY --from=builder /go/src/github.com/pygmystack/pygmy/pygmy-darwin-amd64 .
COPY --from=builder /go/src/github.com/pygmystack/pygmy/pygmy-darwin-arm64 .
COPY --from=builder /go/src/github.com/pygmystack/pygmy/pygmy.exe .