File tree 3 files changed +18
-24
lines changed
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
11
14
CMD ["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
5
5
6
6
LDFLAGS = -X main.version=$(VERSION )
7
7
8
- .PHONY : docker build clean deps
8
+ .PHONY : docker build clean deps zip
9
9
10
10
docker :
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 .
14
14
docker run --rm ecs-gen:latest ecs-gen --version
15
15
16
16
build : deps
17
17
for GOOS in darwin linux; do \
18
18
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 ; \
20
20
done \
21
21
done
22
22
You can’t perform that action at this time.
0 commit comments