From 701ae25bd8ebdc4566e36f6e61f840e2ec9c67b6 Mon Sep 17 00:00:00 2001 From: Nick Boldt Date: Wed, 15 Feb 2023 14:53:10 -0400 Subject: [PATCH] chore: CRW-4043 update rhel.Dockerfile and brew.Dockerfile so they're more closely aligned; update go.sum Change-Id: Iaccd3d8f1e2b68f3f85db08635abcedccbb59e54 Signed-off-by: Nick Boldt --- build/dockerfiles/Dockerfile | 4 +-- build/dockerfiles/brew.Dockerfile | 7 +++--- build/dockerfiles/rhel.Dockerfile | 42 +++++++++++++++---------------- go.sum | 5 ---- 4 files changed, 26 insertions(+), 32 deletions(-) diff --git a/build/dockerfiles/Dockerfile b/build/dockerfiles/Dockerfile index c29c515..93fdc5d 100644 --- a/build/dockerfiles/Dockerfile +++ b/build/dockerfiles/Dockerfile @@ -1,5 +1,5 @@ # -# Copyright (c) 2012-2022 Red Hat, Inc. +# Copyright (c) 2012-2023 Red Hat, Inc. # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 # which is available at https://www.eclipse.org/legal/epl-2.0/ @@ -48,7 +48,7 @@ COPY . ./ ARG VERSION=dev RUN env $(cat /tmp/.env | xargs) go build -a -ldflags '-w -s' -a -installsuffix cgo -o configbump cmd/configbump/main.go -FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.12 +FROM --platform=${TARGETPLATFORM:-linux/amd64} docker.io/alpine:3.12 ARG BUILD_DATE ARG VCS_REF diff --git a/build/dockerfiles/brew.Dockerfile b/build/dockerfiles/brew.Dockerfile index 2d5860d..3cd740a 100644 --- a/build/dockerfiles/brew.Dockerfile +++ b/build/dockerfiles/brew.Dockerfile @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2021 Red Hat, Inc. +# Copyright (c) 2019-2023 Red Hat, Inc. # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 # which is available at https://www.eclipse.org/legal/epl-2.0/ @@ -8,8 +8,8 @@ # Contributors: # Red Hat, Inc. - initial API and implementation # - -# this container build continues from rhel.Dockerfile +# This container build creates configbump binary in a container, using Brew/OSBS and Cachito +# for a local build, see rhel.Dockerfile # https://registry.access.redhat.com/ubi8-minimal FROM ubi8-minimal:8.7-1049.1675784874 @@ -22,6 +22,7 @@ WORKDIR $REMOTE_SOURCES_DIR/devspaces-images-configbump/app/devspaces-configbump RUN microdnf -y install shadow-utils golang && \ adduser appuser && \ export ARCH="$(uname -m)" && if [[ ${ARCH} == "x86_64" ]]; then export ARCH="amd64"; elif [[ ${ARCH} == "aarch64" ]]; then export ARCH="arm64"; fi && \ + go test -v ./... && \ CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -ldflags '-w -s' -a -installsuffix cgo -o configbump cmd/configbump/main.go && \ cp configbump /usr/local/bin/configbump && \ chmod 755 /usr/local/bin/configbump && \ diff --git a/build/dockerfiles/rhel.Dockerfile b/build/dockerfiles/rhel.Dockerfile index 6d953d4..0cc7c84 100644 --- a/build/dockerfiles/rhel.Dockerfile +++ b/build/dockerfiles/rhel.Dockerfile @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2022 Red Hat, Inc. +# Copyright (c) 2019-2023 Red Hat, Inc. # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 # which is available at https://www.eclipse.org/legal/epl-2.0/ @@ -8,30 +8,28 @@ # Contributors: # Red Hat, Inc. - initial API and implementation # -# this container build creates configbump binary +# This container build creates configbump binary in a container +# see also brew.Dockerfile + +# https://registry.access.redhat.com/ubi8-minimal +FROM registry.access.redhat.com/ubi8-minimal:8.7-1049.1675784874 -# https://registry.access.redhat.com/ubi8/go-toolset -FROM registry.access.redhat.com/ubi8/go-toolset:1.18.9-8 as builder -ENV GOPATH=/go/ \ - CGO_ENABLED=0 \ - GOOS=linux -USER root WORKDIR /app -ENV GO111MODULE on -# ENV GOPROXY https://goproxy.io -COPY go.mod . -COPY go.sum . -RUN go mod download && go mod verify COPY . ./ -RUN adduser appuser && \ - go test -v ./... && \ +RUN microdnf -y install shadow-utils golang && \ + adduser appuser && \ export ARCH="$(uname -m)" && if [[ ${ARCH} == "x86_64" ]]; then export ARCH="amd64"; elif [[ ${ARCH} == "aarch64" ]]; then export ARCH="arm64"; fi && \ - CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -ldflags '-w -s' -a -installsuffix cgo -o configbump cmd/configbump/main.go - -# https://registry.access.redhat.com/ubi8/ubi-micro -FROM registry.access.redhat.com/ubi8/ubi-micro:8.7-1 -COPY --from=builder /etc/passwd /etc/passwd + go mod download && go mod verify && \ + go test -v ./... && \ + CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -ldflags '-w -s' -a -installsuffix cgo -o configbump cmd/configbump/main.go && \ + cp configbump /usr/local/bin/configbump && \ + chmod 755 /usr/local/bin/configbump && \ + rm -rf $REMOTE_SOURCES_DIR && \ + microdnf -y remove shadow-utils golang && \ + microdnf -y update || true && \ + microdnf -y clean all && rm -rf /var/cache/yum && \ + echo "Installed Packages" && rpm -qa | sort -V && echo "End Of Installed Packages" USER appuser -COPY --from=builder /app/configbump /usr/local/bin/configbump -ENTRYPOINT [ "/usr/local/bin/configbump" ] + +ENTRYPOINT ["/usr/local/bin/configbump"] diff --git a/go.sum b/go.sum index ec89f17..50c1fd4 100644 --- a/go.sum +++ b/go.sum @@ -21,7 +21,6 @@ github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7 h1:u4bArs140e9+AfE52mFHOXVFnOSBJBRlzTHrOPLOIhE= github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -72,7 +71,6 @@ github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTd github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -89,7 +87,6 @@ golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -101,7 +98,6 @@ gomodules.xyz/jsonpatch/v2 v2.0.1 h1:xyiBuvkD2g5n7cYzx6u2sxQvsAy4QJsZFCzGVdzOXZ0 gomodules.xyz/jsonpatch/v2 v2.0.1/go.mod h1:IhYNNY4jnS53ZnfE4PAmpKtDpTCj1JFXc+3mwe7XcUU= google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -111,7 +107,6 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=