Skip to content

Commit ac0c290

Browse files
authored
Merge pull request kata-containers#124 from devimc/dockerfile/supportProxy
builder: support proxy in distros based on yum or dnf
2 parents ae5b40a + 52d015e commit ac0c290

File tree

6 files changed

+18
-0
lines changed

6 files changed

+18
-0
lines changed

image-builder/Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#
2+
# Copyright (c) 2018 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
16
From fedora:latest
27

8+
RUN [ -n "$http_proxy" ] && sed -i '$ a proxy='$http_proxy /etc/dnf/dnf.conf ; true
9+
310
RUN dnf install -y qemu-img parted gdisk e2fsprogs

rootfs-builder/centos/Dockerfile.in

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
From centos:@OS_VERSION@
77

8+
@SET_PROXY@
9+
810
RUN yum -y update && yum install -y git make gcc coreutils
911

1012
# This will install the proper golang to build Kata components

rootfs-builder/clearlinux/Dockerfile.in

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
From fedora:27
77

8+
@SET_PROXY@
9+
810
RUN dnf -y update && dnf install -y git systemd pkgconfig gcc coreutils
911

1012
# This will install the proper golang to build Kata components

rootfs-builder/euleros/Dockerfile.in

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
FROM euleros:@OS_VERSION@
77

8+
@SET_PROXY@
9+
810
RUN yum -y update && yum install -y yum git make gcc coreutils
911

1012
# This will install the proper golang to build Kata components

rootfs-builder/fedora/Dockerfile.in

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
From fedora:@OS_VERSION@
77

8+
@SET_PROXY@
9+
810
RUN dnf -y update && dnf install -y git redhat-release systemd pkgconfig gcc coreutils
911

1012
# This will install the proper golang to build Kata components

rootfs-builder/rootfs.sh

+3
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ generate_dockerfile()
100100
;;
101101
esac
102102

103+
[ -n "$http_proxy" ] && readonly set_proxy="RUN sed -i '$ a proxy="$http_proxy"' /etc/dnf/dnf.conf /etc/yum.conf; true"
104+
103105
readonly install_go="
104106
ADD https://storage.googleapis.com/golang/go${GO_VERSION}.linux-${goarch}.tar.gz /tmp
105107
RUN tar -C /usr/ -xzf /tmp/go${GO_VERSION}.linux-${goarch}.tar.gz
@@ -115,6 +117,7 @@ ENV PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin
115117
-e "s|@GO_VERSION@|${GO_VERSION}|g" \
116118
-e "s|@OS_VERSION@|${OS_VERSION}|g" \
117119
-e "s|@INSTALL_GO@|${install_go//$'\n'/\\n}|g" \
120+
-e "s|@SET_PROXY@|${set_proxy}|g" \
118121
${dockerfile_template} > Dockerfile
119122
popd
120123
}

0 commit comments

Comments
 (0)