Skip to content

Commit c99a9f7

Browse files
committedFeb 22, 2020
Produce binaries without target platform prefixes by default.
This is aimed at fixing downstream image builds targeting non-amd64 architectures.
1 parent 832487c commit c99a9f7

8 files changed

+21
-19
lines changed
 

‎.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ script:
1919
notifications:
2020
email: false
2121

22+
before_deploy:
23+
- ls bin | xargs -n1 -I{} mv bin/{} "bin/$(go env GOOS)-$(go env GOARCH)-{}"
2224
deploy:
2325
provider: releases
2426
edge: true

‎Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ FROM openshift/origin-base
2828
RUN mkdir /registry
2929
WORKDIR /registry
3030

31-
COPY --from=builder /src/bin/linux-amd64-initializer /bin/initializer
32-
COPY --from=builder /src/bin/linux-amd64-registry-server /bin/registry-server
33-
COPY --from=builder /src/bin/linux-amd64-configmap-server /bin/configmap-server
34-
COPY --from=builder /src/bin/linux-amd64-appregistry-server /bin/appregistry-server
35-
COPY --from=builder /src/bin/linux-amd64-opm /bin/opm
31+
COPY --from=builder /src/bin/initializer /bin/initializer
32+
COPY --from=builder /src/bin/registry-server /bin/registry-server
33+
COPY --from=builder /src/bin/configmap-server /bin/configmap-server
34+
COPY --from=builder /src/bin/appregistry-server /bin/appregistry-server
35+
COPY --from=builder /src/bin/opm /bin/opm
3636
COPY --from=builder /go/bin/grpc-health-probe /bin/grpc_health_probe
3737

3838
RUN chgrp -R 0 /registry && \

‎Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GOOS := $(shell go env GOOS)
22
GOARCH := $(shell go env GOARCH)
3-
CMDS := $(addprefix bin/$(GOOS)-$(GOARCH)-, $(shell ls ./cmd))
3+
CMDS := $(addprefix bin/, $(shell ls ./cmd))
44
SPECIFIC_UNIT_TEST := $(if $(TEST),-run $(TEST),)
55
MOD_FLAGS := $(shell bash -c 'if [[ "$(shell go env GOFLAGS)" == "-mod=vendor" ]]; then echo ""; else echo "-mod=vendor"; fi')
66

@@ -9,7 +9,7 @@ MOD_FLAGS := $(shell bash -c 'if [[ "$(shell go env GOFLAGS)" == "-mod=vendor" ]
99
all: clean test build
1010

1111
$(CMDS):
12-
go build $(MOD_FLAGS) $(extra_flags) -o $@ ./cmd/$(shell basename $@ | cut -d- -f3-)
12+
go build $(MOD_FLAGS) $(extra_flags) -o $@ ./cmd/$(notdir $@)
1313

1414
build: clean $(CMDS)
1515

‎appr-registry.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ COPY --from=builder /go/src/github.com/operator-framework/operator-registry/vend
2222
RUN CGO_ENABLED=0 go install -a -tags netgo -ldflags "-w"
2323

2424
FROM scratch
25-
COPY --from=builder /go/src/github.com/operator-framework/operator-registry/bin/linux-amd64-appregistry-server /bin/appregistry-server
25+
COPY --from=builder /go/src/github.com/operator-framework/operator-registry/bin/appregistry-server /bin/appregistry-server
2626
COPY --from=probe-builder /go/bin/grpc-health-probe /bin/grpc_health_probe
2727
EXPOSE 50051
2828
ENTRYPOINT ["/bin/appregistry-server"]

‎configmap-registry.Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ FROM quay.io/operator-framework/upstream-registry-builder:latest as builder
22
FROM busybox as userspace
33

44
FROM scratch
5-
COPY --from=builder /build/bin/linux-amd64-configmap-server /bin/configmap-server
6-
COPY --from=builder /build/bin/linux-amd64-opm /bin/opm
5+
COPY --from=builder /build/bin/configmap-server /bin/configmap-server
6+
COPY --from=builder /build/bin/opm /bin/opm
77
COPY --from=userspace /bin/cp /bin/cp
88
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
99
EXPOSE 50051

‎opm-example.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM quay.io/operator-framework/upstream-registry-builder AS builder
33
FROM scratch
44
LABEL operators.operatorframework.io.index.database.v1=./index.db
55
COPY database ./
6-
COPY --from=builder /build/bin/linux-amd64-opm /opm
6+
COPY --from=builder /build/bin/opm /opm
77
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
88
EXPOSE 50051
99
ENTRYPOINT ["/opm"]

‎registry.Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ COPY Makefile Makefile
1010
COPY go.mod go.mod
1111
RUN make static
1212
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.1 && \
13-
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
13+
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-$(go env GOARCH) && \
1414
chmod +x /bin/grpc_health_probe
1515

1616
FROM scratch
17-
COPY --from=builder /build/bin/linux-amd64-registry-server /registry-server
17+
COPY --from=builder /build/bin/registry-server /registry-server
1818
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
1919
EXPOSE 50051
2020
ENTRYPOINT ["/registry-server"]

‎upstream-builder.Dockerfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ COPY Makefile Makefile
1010
COPY go.mod go.mod
1111
RUN make static
1212
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.1 && \
13-
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
13+
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-$(go env GOARCH) && \
1414
chmod +x /bin/grpc_health_probe
15-
RUN cp /build/bin/linux-amd64-opm /bin/opm && \
16-
cp /build/bin/linux-amd64-initializer /bin/initializer && \
17-
cp /build/bin/linux-amd64-appregistry-server /bin/appregistry-server && \
18-
cp /build/bin/linux-amd64-configmap-server /bin/configmap-server && \
19-
cp /build/bin/linux-amd64-registry-server /bin/registry-server
15+
RUN cp /build/bin/opm /bin/opm && \
16+
cp /build/bin/initializer /bin/initializer && \
17+
cp /build/bin/appregistry-server /bin/appregistry-server && \
18+
cp /build/bin/configmap-server /bin/configmap-server && \
19+
cp /build/bin/registry-server /bin/registry-server

0 commit comments

Comments
 (0)
Please sign in to comment.