Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

Commit e8df94c

Browse files
committed
dockerfile: Install recommended golang from runtime
Instead of install golang from fedora install the version recommended by the runtime. Signed-off-by: Jose Carlos Venegas Munoz <[email protected]>
1 parent ca36cca commit e8df94c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ IMAGE_BUILDER = cc-osbuilder
3939
WORKDIR ?= $(CURDIR)/workdir
4040
MK_DIR :=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
4141
OS_BUILDER ?= $(MK_DIR)/scripts/osbuilder.sh
42-
42+
RUNTIME_VERSIONS = "https://raw.githubusercontent.com/clearcontainers/runtime/master/versions.txt"
43+
#get go_version=<version>
44+
GO_VERSION = $(shell curl -sL $(RUNTIME_VERSIONS) | grep '^go_version=' | cut -d= -f2)
45+
BUILD_GO_VERSION+= --build-arg GO_VERSION=$(GO_VERSION)
4346

4447
# Installation variables
4548
DESTDIR :=
@@ -109,7 +112,7 @@ kernel-src: $(WORKDIR) $(DOCKER_DEPS)
109112

110113
docker-build:
111114
cd scripts; \
112-
docker build $(BUILD_PROXY) -t $(IMAGE_BUILDER) .
115+
docker build $(BUILD_PROXY) $(BUILD_GO_VERSION) -t $(IMAGE_BUILDER) .
113116

114117
clean:
115118
sudo rm -rf "$(WORKDIR)/rootfs"

scripts/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@
1717

1818
From fedora:27
1919

20-
RUN dnf install -y qemu-img parted gdisk make gcc bc git e2fsprogs go libudev-devel
20+
RUN dnf install -y qemu-img parted gdisk make gcc bc git e2fsprogs libudev-devel pkgconfig
21+
22+
ARG GO_VERSION
23+
24+
RUN cd /tmp && curl -OL https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz
25+
RUN tar -C /usr/ -xzf /tmp/go${GO_VERSION}.linux-amd64.tar.gz
26+
ENV GOROOT=/usr/go
27+
ENV PATH=$PATH:$GOROOT/bin:$GOPATH/bin
2128

2229
ENV workdir /workdir
2330
WORKDIR ${workdir}

0 commit comments

Comments
 (0)