Skip to content

Commit

Permalink
Use pulled images
Browse files Browse the repository at this point in the history
Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
  • Loading branch information
antoninbas committed Jun 27, 2024
1 parent e9c6baf commit 0feeb68
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build/images/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM ubuntu:22.04 AS cni-binaries
FROM ubuntu AS cni-binaries

ARG CNI_BINARIES_VERSION

Expand Down
5 changes: 2 additions & 3 deletions build/images/base/Dockerfile.ubi
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG BUILD_TAG
FROM ubuntu:22.04 AS cni-binaries
FROM ubuntu AS cni-binaries

ARG CNI_BINARIES_VERSION

Expand All @@ -35,7 +34,7 @@ RUN set -eux; \
mkdir -p /opt/cni/bin; \
wget -q -O - https://github.com/containernetworking/plugins/releases/download/$CNI_BINARIES_VERSION/cni-plugins-linux-${pluginsArch}-$CNI_BINARIES_VERSION.tgz | tar xz -C /opt/cni/bin $CNI_PLUGINS

FROM antrea/openvswitch-ubi:${BUILD_TAG}
FROM antrea-openvswitch

ARG SURICATA_VERSION

Expand Down
6 changes: 5 additions & 1 deletion build/images/base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ function docker_build_and_push() {
local image="$1"
local dockerfile="$2"
local build_args="--build-arg CNI_BINARIES_VERSION=$CNI_BINARIES_VERSION --build-arg SURICATA_VERSION=$SURICATA_VERSION --build-arg BUILD_TAG=$BUILD_TAG"
local build_contexts="--build-context antrea-openvswitch=docker-image://antrea/openvswitch:${BUILD_TAG}"
if [ "$DISTRO" == "ubuntu" ]; then
local build_contexts="--build-context ubuntu=docker-image://ubuntu:22.04 --build-context antrea-openvswitch=docker-image://antrea/openvswitch:${BUILD_TAG}"
elif [ "$DISTRO" == "ubi" ]; then
local build_contexts="--build-context ubuntu=docker-image://ubuntu:22.04 --build-context antrea-openvswitch=docker-image://antrea/openvswitch-ubi:${BUILD_TAG}"
fi
local cache_args=""
if $PUSH; then
cache_args="$cache_args --cache-to type=registry,ref=$image-cache:$BUILD_CACHE_TAG,mode=max"
Expand Down
4 changes: 2 additions & 2 deletions build/images/ovs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM ubuntu:22.04 AS ovs-debs
FROM ubuntu AS ovs-debs

# Some patches may not apply cleanly if a non-default version is provided.
# See build/images/deps/ovs-version for the default version.
Expand All @@ -39,7 +39,7 @@ RUN wget -q -O - https://www.openvswitch.org/releases/openvswitch-$OVS_VERSION.t
cd / && rm -rf /tmp/openvswitch*


FROM ubuntu:22.04
FROM ubuntu

LABEL maintainer="Antrea <projectantrea-dev@googlegroups.com>"
LABEL description="A Docker image based on Ubuntu 22.04 which includes Open vSwitch built from source."
Expand Down
4 changes: 2 additions & 2 deletions build/images/ovs/Dockerfile.ubi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM quay.io/centos/centos:stream9 AS ovs-rpms
FROM centos AS ovs-rpms
# Some patches may not apply cleanly if a non-default version is provided.
# See build/images/deps/ovs-version for the default version.
ARG OVS_VERSION
Expand All @@ -39,7 +39,7 @@ RUN cd /tmp/openvswitch* && \
mv /tmp/openvswitch-$OVS_VERSION/rpm/rpmbuild/RPMS/*/*.rpm /tmp/ovs-rpms && \
rm -rf /tmp/openvswitch*

FROM registry.access.redhat.com/ubi9
FROM ubi9
ARG OVS_VERSION

LABEL maintainer="Antrea <projectantrea-dev@googlegroups.com>"
Expand Down
7 changes: 6 additions & 1 deletion build/images/ovs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ function docker_build_and_push() {
local image="$1"
local dockerfile="$2"
local build_args="--build-arg OVS_VERSION=$OVS_VERSION"
if [ "$DISTRO" == "ubuntu" ]; then
local build_contexts="--build-context ubuntu=docker-image://ubuntu:22.04"
elif [ "$DISTRO" == "ubi" ]; then
local build_contexts="--build-context centos=docker-image://quay.io/centos/centos:stream9 --build-context ubi9=docker-image://registry.access.redhat.com/ubi9"
fi
local cache_args=""
if $PUSH; then
cache_args="$cache_args --cache-to type=registry,ref=$image-cache:$BUILD_CACHE_TAG,mode=max"
Expand All @@ -151,7 +156,7 @@ function docker_build_and_push() {
else
cache_args="$cache_args --cache-from type=registry,ref=$image-cache:$BUILD_CACHE_TAG,mode=max"
fi
docker buildx build $PLATFORM_ARG -o type=docker -t $image:$BUILD_TAG $cache_args $build_args -f $dockerfile .
docker buildx build $PLATFORM_ARG -o type=docker -t $image:$BUILD_TAG $cache_args $build_contexts $build_args -f $dockerfile .

if $PUSH; then
docker push $image:$BUILD_TAG
Expand Down

0 comments on commit 0feeb68

Please sign in to comment.