-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use an Antrea base image instead of Ubuntu (#940)
Fix #939. Signed-off-by: Weiqiang Tang <weiqiangt@vmware.com>
- Loading branch information
Showing
5 changed files
with
79 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,9 @@ | ||
FROM ubuntu:18.04 as cni-binaries | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends wget ca-certificates | ||
|
||
# Leading dot is required for the tar command below | ||
ENV CNI_PLUGINS="./host-local ./loopback ./portmap" | ||
|
||
RUN mkdir -p /opt/cni/bin && \ | ||
wget -q -O - https://github.com/containernetworking/plugins/releases/download/v0.8.6/cni-plugins-linux-amd64-v0.8.6.tgz | tar xz -C /opt/cni/bin $CNI_PLUGINS | ||
|
||
|
||
FROM antrea/openvswitch:2.13.0 | ||
FROM antrea/base-ubuntu:2.13.0 | ||
|
||
LABEL maintainer="Antrea <projectantrea-dev@googlegroups.com>" | ||
LABEL description="A Docker image to deploy the Antrea CNI. Requires the Antrea binaries to be built prior to building the image." | ||
LABEL description="The Docker image to deploy the Antrea CNI. " | ||
|
||
USER root | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
ipset \ | ||
jq \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=cni-binaries /opt/cni/bin /opt/cni/bin | ||
|
||
COPY build/images/scripts/* /usr/local/bin/ | ||
COPY bin/* /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,26 @@ | ||
ARG OVS_VERSION=2.13.0 | ||
FROM ubuntu:18.04 as cni-binaries | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends wget ca-certificates | ||
|
||
# Leading dot is required for the tar command below | ||
ENV CNI_PLUGINS="./host-local ./loopback ./portmap" | ||
|
||
RUN mkdir -p /opt/cni/bin && \ | ||
wget -q -O - https://github.com/containernetworking/plugins/releases/download/v0.8.6/cni-plugins-linux-amd64-v0.8.6.tgz | tar xz -C /opt/cni/bin $CNI_PLUGINS | ||
|
||
|
||
FROM antrea/openvswitch:${OVS_VERSION} | ||
|
||
LABEL maintainer="Antrea <projectantrea-dev@googlegroups.com>" | ||
LABEL description="Takes care of building the Antrea binaries as part of building the image." | ||
|
||
USER root | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
ipset \ | ||
jq \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=cni-binaries /opt/cni/bin /opt/cni/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,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2020 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. | ||
|
||
# This is a very simple script that builds the base image for Antrea and pushes it to | ||
# the Antrea Dockerhub (https://hub.docker.com/u/antrea). The image is tagged with the OVS version. | ||
|
||
set -eo pipefail | ||
|
||
function echoerr { | ||
>&2 echo "$@" | ||
} | ||
|
||
if [ -z "$OVS_VERSION" ]; then | ||
echoerr "The OVS_VERSION env variable must be set to a valid value (e.g. 2.13.0)" | ||
exit 1 | ||
fi | ||
|
||
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
pushd $THIS_DIR > /dev/null | ||
|
||
docker pull ubuntu:18.04 | ||
|
||
docker pull antrea/openvswitch:$OVS_VERSION | ||
|
||
docker build \ | ||
-t antrea/base-ubuntu:$OVS_VERSION \ | ||
-f Dockerfile \ | ||
--build-arg OVS_VERSION=$OVS_VERSION . | ||
|
||
docker push antrea/base-ubuntu:$OVS_VERSION | ||
|
||
popd > /dev/null |