File tree Expand file tree Collapse file tree 3 files changed +18
-24
lines changed Expand file tree Collapse file tree 3 files changed +18
-24
lines changed Original file line number Diff line number Diff line change 1- FROM alpine
2-
3- WORKDIR /root
4-
5- RUN apk update && apk add ca-certificates openssl && update-ca-certificates
6-
7- # download release of ecs-gen
8- ENV ECS_GEN_RELEASE 0.3.2
9- RUN wget https://github.com/codesuki/ecs-gen/releases/download/$ECS_GEN_RELEASE/ecs-gen-linux-amd64.zip && unzip ecs-gen-linux-amd64.zip && cp ecs-gen-linux-amd64 /usr/local/bin/ecs-gen
10-
1+ FROM golang:1.7.3-alpine AS builder
2+ RUN apk update && apk add --no-cache git make
3+ WORKDIR /go/src/github.com/codesuki/ecs-gen
4+ COPY glide.lock glide.yaml Makefile /go/src/github.com/codesuki/ecs-gen/
5+ # to statically link
6+ ENV CGO_ENABLED 0
7+ RUN go get -u github.com/Masterminds/glide && make deps
8+ COPY . .
9+ RUN make build
10+
11+ FROM alpine:3.8
12+ RUN apk update && apk add --no-cache ca-certificates openssl && update-ca-certificates
13+ COPY --from=builder /go/src/github.com/codesuki/ecs-gen/build/ecs-gen-linux-amd64 /usr/bin/ecs-gen
1114CMD ["ecs-gen" ]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -5,18 +5,18 @@ WORKDIR = /go/src/github.com/codesuki/ecs-gen
55
66LDFLAGS = -X main.version=$(VERSION )
77
8- .PHONY : docker build clean deps
8+ .PHONY : docker build clean deps zip
99
1010docker :
11- docker build -t ecs-gen-builder :latest -f Dockerfile.build .
12- docker run --rm - v $(CURDIR ) : $( WORKDIR ) ecs-gen-builder
13- docker build -t ecs-gen:latest -f Dockerfile .
11+ docker build --target builder - t ecs-gen:latest .
12+ docker run -v $(CURDIR ) /build:/mnt/build --rm ecs-gen:latest cp -R $( WORKDIR ) /build/ /mnt/
13+ docker build -t ecs-gen:latest .
1414 docker run --rm ecs-gen:latest ecs-gen --version
1515
1616build : deps
1717 for GOOS in darwin linux; do \
1818 for GOARCH in 386 amd64; do \
19- GOOS=$$ GOOS GOARCH=$$ GOARCH go build -ldflags " $( LDFLAGS) " -v - o build/$(NAME ) -$$ GOOS-$$ GOARCH ; \
19+ GOOS=$$ GOOS GOARCH=$$ GOARCH go build -ldflags " $( LDFLAGS) " -o build/$(NAME ) -$$ GOOS-$$ GOARCH ; \
2020 done \
2121 done
2222
You can’t perform that action at this time.
0 commit comments