-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MGMT-18965: Update docker files to use universal base image #905
Open
paul-maidment
wants to merge
1
commit into
openshift:release-4.16
Choose a base branch
from
paul-maidment:MGMT-18965
base: release-4.16
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,34 @@ | ||
FROM registry.ci.openshift.org/openshift/release:golang-1.20 | ||
ENV GO111MODULE=on | ||
FROM registry.access.redhat.com/ubi9/go-toolset:1.20 AS golang | ||
|
||
ENV GOFLAGS="" | ||
|
||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/bin v1.53.2 | ||
RUN yum install -y docker && \ | ||
yum clean all | ||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.2 && \ | ||
go install golang.org/x/tools/cmd/[email protected] && \ | ||
go install github.com/onsi/ginkgo/[email protected] && \ | ||
go install github.com/golang/mock/[email protected] && \ | ||
go install gotest.tools/[email protected] && \ | ||
go install github.com/axw/gocov/gocov@latest && \ | ||
go install github.com/AlekSi/gocov-xml@latest | ||
|
||
FROM quay.io/centos/centos:stream9 | ||
|
||
RUN dnf install -y 'dnf-command(config-manager)' && \ | ||
dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo && \ | ||
dnf install -y \ | ||
docker-ce \ | ||
docker-ce-cli \ | ||
containerd.io \ | ||
make \ | ||
git \ | ||
openssl-devel \ | ||
gcc \ | ||
&& dnf clean all | ||
|
||
ENV GOROOT=/usr/lib/golang | ||
ENV GOPATH=/opt/app-root/src/go | ||
ENV PATH=$PATH:$GOROOT/bin:$GOPATH/bin | ||
|
||
COPY --from=golang $GOPATH $GOPATH | ||
COPY --from=golang $GOROOT $GOROOT | ||
|
||
RUN go install golang.org/x/tools/cmd/[email protected] && \ | ||
go install github.com/onsi/ginkgo/[email protected] && \ | ||
go install github.com/golang/mock/[email protected] && \ | ||
go install gotest.tools/[email protected] && \ | ||
go install github.com/axw/gocov/gocov@latest && \ | ||
go install github.com/AlekSi/gocov-xml@latest | ||
RUN chmod 775 -R $GOPATH && chmod 775 -R $GOROOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
FROM quay.io/openshift/origin-cli-artifacts:latest as cli-artifacts | ||
ARG TARGETPLATFORM | ||
RUN mkdir -p /usr/share/openshift/assisted | ||
RUN case $TARGETPLATFORM in "") dir=linux_amd64;; *) dir=`echo $TARGETPLATFORM | sed 's@/@_@'` ;; esac ; ln /usr/share/openshift/${dir}/oc /usr/share/openshift/assisted | ||
|
||
FROM registry.ci.openshift.org/openshift/release:golang-1.20 AS builder | ||
FROM registry.access.redhat.com/ubi9/go-toolset:1.20 AS builder | ||
ARG TARGETPLATFORM | ||
ENV GOFLAGS=-mod=mod | ||
WORKDIR /go/src/github.com/openshift/assisted-installer | ||
|
||
# Workaround for creating build folder | ||
USER root | ||
|
||
# Bring in the go dependencies before anything else so we can take | ||
# advantage of caching these layers in future builds. | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
RUN go mod download | ||
|
||
COPY . . | ||
RUN TARGETPLATFORM=$TARGETPLATFORM make controller | ||
RUN git config --global --add safe.directory '*'; \ | ||
TARGETPLATFORM=$TARGETPLATFORM make controller | ||
|
||
FROM quay.io/centos/centos:stream9 | ||
ARG TARGETPLATFORM | ||
|
||
# openshift clients | ||
RUN case $TARGETPLATFORM in "") platform=amd64;; *) platform=`echo $TARGETPLATFORM | sed 's#linux/##'` ;; esac ; \ | ||
curl -k -L -s "https://mirror.openshift.com/pub/openshift-v4/multi/clients/ocp/latest/amd64/openshift-client-linux-${platform}-rhel9.tar.gz" | tar xvz -C /usr/bin; \ | ||
chmod +x /usr/bin/oc /usr/bin/kubectl | ||
|
||
COPY --from=cli-artifacts /usr/share/openshift/assisted/oc /usr/bin/oc | ||
COPY --from=builder /go/src/github.com/openshift/assisted-installer/build/assisted-installer-controller /usr/bin/assisted-installer-controller | ||
|
||
ENTRYPOINT ["/usr/bin/assisted-installer-controller"] | ||
ENTRYPOINT ["/usr/bin/assisted-installer-controller"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,29 @@ | ||
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.21-openshift-4.16 AS builder | ||
|
||
FROM registry.access.redhat.com/ubi9/go-toolset:1.20 AS builder | ||
ARG TARGETPLATFORM | ||
ENV GOFLAGS=-mod=mod | ||
WORKDIR /go/src/github.com/openshift/assisted-installer | ||
ENV GOFLAGS="-mod=vendor" | ||
|
||
# Workaround for creating build folder | ||
USER root | ||
|
||
# Bring in the go dependencies before anything else so we can take | ||
# advantage of caching these layers in future builds. | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
RUN go mod download | ||
|
||
COPY . . | ||
RUN make controller | ||
RUN git config --global --add safe.directory '*'; \ | ||
TARGETPLATFORM=$TARGETPLATFORM make controller | ||
|
||
FROM registry.ci.openshift.org/ocp/4.16:base-rhel9 | ||
FROM quay.io/centos/centos:stream9 | ||
ARG TARGETPLATFORM | ||
|
||
LABEL io.openshift.release.operator=true | ||
# openshift clients | ||
RUN case $TARGETPLATFORM in "") platform=amd64;; *) platform=`echo $TARGETPLATFORM | sed 's#linux/##'` ;; esac ; \ | ||
curl -k -L -s "https://mirror.openshift.com/pub/openshift-v4/multi/clients/ocp/latest/amd64/openshift-client-linux-${platform}-rhel9.tar.gz" | tar xvz -C /usr/bin; \ | ||
chmod +x /usr/bin/oc /usr/bin/kubectl | ||
|
||
COPY --from=builder /go/src/github.com/openshift/assisted-installer/build/assisted-installer-controller /usr/bin/assisted-installer-controller | ||
RUN dnf install -y --nodocs --setopt=install_weak_deps=False openshift-clients \ | ||
&& dnf clean all && rm -rf /var/cache/* | ||
|
||
ENTRYPOINT ["/usr/bin/assisted-installer-controller"] | ||
ENTRYPOINT ["/usr/bin/assisted-installer-controller"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why using a workaround when we can use this image the way it's meant to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not being used correctly on master?
https://github.com/openshift/assisted-installer/blob/master/Dockerfile.assisted-installer#L7