Skip to content

Commit

Permalink
Update go to v1.16. Cleanup dockerfiles. (stolostron#58)
Browse files Browse the repository at this point in the history
* Update go to v1.16. Cleanup dockerfiles.

* Revert registry namespace change
  • Loading branch information
JakobGray authored Mar 29, 2021
1 parent 1894511 commit d50a3ca
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 20 deletions.
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# Copyright Contributors to the Open Cluster Management project

# Build the manager binary
FROM golang:1.15 as builder
FROM golang:1.16 as builder

WORKDIR /workspace

# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum

# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY pkg/ pkg/
COPY util/ util/
COPY . .

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
RUN go build -a -o manager main.go

# Use ubi-minimal as minimal base image to package the manager binary
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
Expand Down
12 changes: 5 additions & 7 deletions Dockerfile.prow
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# Build the manager binary
FROM registry.ci.openshift.org/open-cluster-management/builder:go1.15-linux-amd64 AS builder
FROM registry.ci.openshift.org/open-cluster-management/builder:go1.16-linux-amd64 AS builder

WORKDIR /workspace

# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum

# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY pkg/ pkg/
COPY util/ util/
COPY . .

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
RUN go build -a -o manager main.go

# Use ubi-minimal as minimal base image to package the manager binary
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.test.prow
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright Contributors to the Open Cluster Management project

FROM registry.ci.openshift.org/open-cluster-management/builder:go1.15-linux-amd64 AS builder
FROM registry.ci.openshift.org/open-cluster-management/builder:go1.16-linux-amd64 AS builder

WORKDIR /workspace

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Operator for managing discovered clusters from OpenShift Cluster Manager

## Prerequisites

- Go v1.15+
- Go v1.16+
- kubectl 1.19+
- Operator-sdk v1.3.0
- Docker
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/open-cluster-management/discovery

go 1.15
go 1.16

require (
github.com/gin-gonic/gin v1.6.3
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright Contributors to the Open Cluster Management project

FROM golang:1.15 as builder
FROM golang:1.16 as builder

WORKDIR /workspace

Expand Down
14 changes: 12 additions & 2 deletions testserver/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# Copyright Contributors to the Open Cluster Management project

FROM golang:1.15 as builder
FROM golang:1.16 as builder

WORKDIR /workspace

# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum

# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY . .

RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o local-server testserver/main.go
# Build
RUN go build -a -o local-server testserver/main.go

FROM registry.access.redhat.com/ubi8/ubi-minimal:latest

Expand Down

0 comments on commit d50a3ca

Please sign in to comment.