-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split the ubi image of Antrea into two images.
Signed-off-by: Pulkit Jain <[email protected]>
- Loading branch information
Pulkit Jain
committed
Jan 19, 2024
1 parent
ae9ac38
commit d182a56
Showing
9 changed files
with
191 additions
and
5 deletions.
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
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
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
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Copyright 2024 Antrea Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ARG BUILD_TAG | ||
FROM registry.access.redhat.com/ubi8 as antrea-build | ||
|
||
ADD https://go.dev/dl/?mode=json&include=all go-versions.json | ||
|
||
RUN yum install ca-certificates gcc git jq make wget -y | ||
|
||
ARG GO_VERSION | ||
|
||
# GO_VERSION is a Go minor version, we use the downloaded go-versions.json file | ||
# to identify and install the latest patch release for this minor version. | ||
RUN set -eux; \ | ||
arch="$(uname -m)"; \ | ||
case "${arch##*-}" in \ | ||
x86_64) goArch='amd64' ;; \ | ||
arm) goArch='armv6l' ;; \ | ||
aarch64) goArch='arm64' ;; \ | ||
*) goArch=''; echo >&2; echo >&2 "unsupported architecture '$arch'"; echo >&2 ; exit 1 ;; \ | ||
esac; \ | ||
GO_ARCHIVE=$(jq --arg version_prefix "go${GO_VERSION}." --arg arch "$goArch" -r '. | map(select(. | .version | startswith($version_prefix))) | first | .files[] | select(.os == "linux" and .arch == $arch and .kind == "archive").filename' go-versions.json); \ | ||
wget -q -O - https://go.dev/dl/${GO_ARCHIVE} | tar xz -C /usr/local/ | ||
|
||
# Using ENV makes the change persistent, but this is just a builder image. | ||
ENV PATH /usr/local/go/bin:$PATH | ||
|
||
WORKDIR /antrea | ||
|
||
COPY go.mod /antrea/go.mod | ||
|
||
RUN go mod download | ||
|
||
COPY . /antrea | ||
|
||
RUN make antrea-agent antrea-cni | ||
# Disable CGO for antctl in case it is copied outside of the container image. It | ||
# also reduces the size of the binary and aligns with how we distribute antctl | ||
# in release assets. | ||
RUN CGO_ENABLED=0 make antctl-linux | ||
RUN mv bin/antctl-linux bin/antctl | ||
|
||
FROM antrea/base-ubi:${BUILD_TAG} | ||
|
||
LABEL maintainer="Antrea <[email protected]>" | ||
LABEL description="The Docker image to deploy the antrea-agent." | ||
|
||
USER root | ||
|
||
COPY build/images/scripts/* /usr/local/bin/ | ||
COPY --from=antrea-build /antrea/bin/antrea-agent /usr/local/bin/ | ||
COPY --from=antrea-build /antrea/bin/antrea-cni /usr/local/bin/ | ||
COPY --from=antrea-build /antrea/bin/antctl /usr/local/bin/ |
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Copyright 2024 Antrea Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ARG BUILD_TAG | ||
FROM registry.access.redhat.com/ubi8 as antrea-build | ||
|
||
ADD https://go.dev/dl/?mode=json&include=all go-versions.json | ||
|
||
RUN yum install ca-certificates gcc git jq make wget -y | ||
|
||
ARG GO_VERSION | ||
|
||
# GO_VERSION is a Go minor version, we use the downloaded go-versions.json file | ||
# to identify and install the latest patch release for this minor version. | ||
RUN set -eux; \ | ||
arch="$(uname -m)"; \ | ||
case "${arch##*-}" in \ | ||
x86_64) goArch='amd64' ;; \ | ||
arm) goArch='armv6l' ;; \ | ||
aarch64) goArch='arm64' ;; \ | ||
*) goArch=''; echo >&2; echo >&2 "unsupported architecture '$arch'"; echo >&2 ; exit 1 ;; \ | ||
esac; \ | ||
GO_ARCHIVE=$(jq --arg version_prefix "go${GO_VERSION}." --arg arch "$goArch" -r '. | map(select(. | .version | startswith($version_prefix))) | first | .files[] | select(.os == "linux" and .arch == $arch and .kind == "archive").filename' go-versions.json); \ | ||
wget -q -O - https://go.dev/dl/${GO_ARCHIVE} | tar xz -C /usr/local/ | ||
|
||
# Using ENV makes the change persistent, but this is just a builder image. | ||
ENV PATH /usr/local/go/bin:$PATH | ||
|
||
WORKDIR /antrea | ||
|
||
COPY go.mod /antrea/go.mod | ||
|
||
RUN go mod download | ||
|
||
COPY . /antrea | ||
|
||
RUN make antrea-controller | ||
# Disable CGO for antctl in case it is copied outside of the container image. It | ||
# also reduces the size of the binary and aligns with how we distribute antctl | ||
# in release assets. | ||
RUN CGO_ENABLED=0 make antctl-linux | ||
RUN mv bin/antctl-linux bin/antctl | ||
|
||
FROM ubuntu:22.04 | ||
|
||
LABEL maintainer="Antrea <[email protected]>" | ||
LABEL description="The Docker image to deploy the antrea-controller." | ||
|
||
USER root | ||
|
||
COPY --from=antrea-build /antrea/bin/antctl /usr/local/bin/ | ||
COPY --from=antrea-build /antrea/bin/antrea-controller /usr/local/bin/ |
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