File tree Expand file tree Collapse file tree 3 files changed +31
-16
lines changed Expand file tree Collapse file tree 3 files changed +31
-16
lines changed Original file line number Diff line number Diff line change
1
+ FROM golang:1.8.3-alpine3.6 as builder
2
+ WORKDIR /x/src/github.com/sapcc/swift-http-import/
3
+ RUN apk add --no-cache curl make openssl && \
4
+ mkdir -p /pkg/bin/ && \
5
+ curl -L https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 > /pkg/bin/dumb-init && \
6
+ chmod +x /pkg/bin/dumb-init
7
+
8
+ COPY . .
9
+ RUN make install PREFIX=/pkg
10
+
11
+ # ###############################################################################
12
+
1
13
FROM alpine:latest
2
14
MAINTAINER "Stefan Majewsky <[email protected] >"
15
+ RUN apk add --no-cache ca-certificates
3
16
4
- # wget(1) is only used to retrieve dumb-init
5
- RUN apk update && \
6
- apk add wget ca-certificates && \
7
- wget -O /bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 && \
8
- chmod +x /bin/dumb-init && \
9
- apk del wget
10
-
11
- ADD swift-http-import /bin/swift-http-import
12
- ENTRYPOINT ["/bin/dumb-init" , "--" , "/bin/swift-http-import" ]
17
+ COPY --from=builder /pkg/ /usr/
18
+ ENTRYPOINT ["/usr/bin/dumb-init" , "--" , "/usr/bin/swift-http-import" ]
Original file line number Diff line number Diff line change 1
- all : swift-http-import
1
+ PKG = github.com/sapcc/swift-http-import
2
+ PREFIX := /usr
3
+
4
+ all : build/swift-http-import
2
5
3
6
# force people to use golangvend
4
- GOCC := env GOPATH=$(CURDIR ) /.gopath go
5
- GOFLAGS := -ldflags '-s -w'
7
+ GO := GOPATH=$(CURDIR ) /.gopath GOBIN=$(CURDIR ) /build go
8
+ GO_BUILDFLAGS :=
9
+ GO_LDFLAGS := -s -w
6
10
7
- swift-http-import : * .go
8
- $(GOCC ) build $(GOFLAGS ) -o $@ github.com/sapcc/swift-http-import
11
+ build/ swift-http-import : FORCE
12
+ $(GO ) install $(GO_BUILDFLAGS ) -ldflags ' $(GO_LDFLAGS) ' ' $(PKG) '
9
13
10
14
check : all
11
15
bash tests.sh http
12
16
bash tests.sh swift
13
17
echo -e ' \e[1;32mSuccess!\e[0m'
14
18
19
+ install : FORCE all
20
+ install -D -m 0755 build/swift-http-import " $( DESTDIR) $( PREFIX) /bin/swift-http-import"
21
+
15
22
vendor :
23
+ @# vendoring by https://github.com/holocm/golangvend
16
24
@golangvend
17
- .PHONY : vendor
25
+
26
+ .PHONY : FORCE
Original file line number Diff line number Diff line change 88
88
89
89
mirror () {
90
90
# config file comes from stdin
91
- ./swift-http-import /proc/self/fd/0
91
+ ./build/ swift-http-import /proc/self/fd/0
92
92
# wait for container listing to get updated
93
93
sleep 15
94
94
}
You can’t perform that action at this time.
0 commit comments