浣跨敤buildpack-deps 鏋勫缓鑷繁鐨勫叆瀹瑰櫒闀滃儚
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了浣跨敤buildpack-deps 鏋勫缓鑷繁鐨勫叆瀹瑰櫒闀滃儚相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/ccf' title='ccf'>ccf
golang save generated container freebsd path default 瀹樻柟buildpack-deps 鏄痙ocker hub 瀹樻柟鎻愪緵鐨勪竴涓瀯寤虹被浼糷eroku stack 闀滃儚鐨勫伐鍏峰寘锛屽鏋滆嚜宸辩湅鐨勮瘽锛屽ソ澶歞ocker 瀹樻柟鐨勫熀纭€闀滃儚閮藉熀浜庢鍩虹闀滃儚
杩涜鏋勫缓鐨勶紝buildpack-deps 宸茬粡鎻愪緵浜嗗ソ澶氬唴缃ソ澶氫緷璧栧簱锛屽彲浠ョ畝鍖栨垜浠殑闀滃儚閮ㄧ讲锛屽悓鏃跺畼鏂逛篃鎻愪緵浜哾ebian浠ュ強ubuntu 绛夌殑闀滃儚锛屽緢鍊煎緱浣跨敤
FROM buildpack-deps:buster-scm
?
# gcc for cgo
RUN apt-get update && apt-get install -y --no-install-recommends
g++
gcc
libc6-dev
make
pkg-config
&& rm -rf /var/lib/apt/lists/*
?
ENV PATH /usr/local/go/bin:$PATH
?
ENV GOLANG_VERSION 1.14.6
?
RUN set -eux;
# this "case" statement is generated via "update.sh"
dpkgArch="$(dpkg --print-architecture)";
case "${dpkgArch##*-}" in
amd64) goRelArch=鈥榣inux-amd64鈥? goRelSha256=鈥?c566ddc2e0bcfc25c26a5dc44a440fcc0177f7350c1f01952b34d5989a0d287鈥?;;
armhf) goRelArch=鈥榣inux-armv6l鈥? goRelSha256=鈥榗ab39cc0fdf9731476a339af9d7bcd8fc661bfa323abb1ce9d1633fb31daeb07鈥?;;
arm64) goRelArch=鈥榣inux-arm64鈥? goRelSha256=鈥?91bccfd7d7f1915599bbcc90e49d9fccfcb0004b7c62a2f5cdf0f96a09d6a3e鈥?;;
i386) goRelArch=鈥榣inux-386鈥? goRelSha256=鈥?7b2c4e26bd3a82a0a44499ae2d36e3f2155d0fe2f6b9a14ac6b7c5afac3ca6a鈥?;;
ppc64el) goRelArch=鈥榣inux-ppc64le鈥? goRelSha256=鈥?eb4c84e7b6aa9edb966c467dd6764d131a57d27afbd87cc8f6d10535df9e898鈥?;;
s390x) goRelArch=鈥榣inux-s390x鈥? goRelSha256=鈥榗b1f2d001ce15e51f7c4bd43f15045ea23d49268010bb981110242a532138749鈥?;;
*) goRelArch=鈥榮rc鈥? goRelSha256=鈥?3fc9d781815d411928eccb92bf20d5b4264797be69410eac854babe44c94c09鈥?
echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;;
esac;
url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz";
wget -O go.tgz "$url" --progress=dot:giga;
echo "${goRelSha256} *go.tgz" | sha256sum -c -;
tar -C /usr/local -xzf go.tgz;
rm go.tgz;
# https://github.com/golang/go/issues/38536#issuecomment-616897960
if [ "$goRelArch" = 鈥榮rc鈥?]; then
savedAptMark="$(apt-mark showmanual)";
apt-get update;
apt-get install -y --no-install-recommends golang-go;
goEnv="$(go env | sed -rn -e 鈥?^GO(OS|ARCH|ARM|386)=/s//export /p鈥?";
eval "$goEnv";
[ -n "$GOOS" ];
[ -n "$GOARCH" ];
(
cd /usr/local/go/src;
./make.bash;
);
apt-mark auto 鈥?*鈥?> /dev/null;
apt-mark manual $savedAptMark > /dev/null;
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false;
rm -rf /var/lib/apt/lists/*;
# pre-compile the standard library, just like the official binary release tarballs do
go install std;
# go install: -race is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64, darwin/amd64 and windows/amd64
# go install -race std;
# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain
rm -rf
/usr/local/go/pkg/*/cmd
/usr/local/go/pkg/bootstrap
/usr/local/go/pkg/obj
/usr/local/go/pkg/tool/*/api
/usr/local/go/pkg/tool/*/go_bootstrap
/usr/local/go/src/cmd/dist/dist
;
fi;
go version
?
ENV GOPATH /go
ENV PATH $GOPATH/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
FROM buildpack-deps:buster-scm
?
# gcc for cgo
RUN apt-get update && apt-get install -y --no-install-recommends
g++
gcc
libc6-dev
make
pkg-config
&& rm -rf /var/lib/apt/lists/*
?
ENV PATH /usr/local/go/bin:$PATH
?
ENV GOLANG_VERSION 1.14.6
?
RUN set -eux;
# this "case" statement is generated via "update.sh"
dpkgArch="$(dpkg --print-architecture)";
case "${dpkgArch##*-}" in
amd64) goRelArch=鈥榣inux-amd64鈥? goRelSha256=鈥?c566ddc2e0bcfc25c26a5dc44a440fcc0177f7350c1f01952b34d5989a0d287鈥?;;
armhf) goRelArch=鈥榣inux-armv6l鈥? goRelSha256=鈥榗ab39cc0fdf9731476a339af9d7bcd8fc661bfa323abb1ce9d1633fb31daeb07鈥?;;
arm64) goRelArch=鈥榣inux-arm64鈥? goRelSha256=鈥?91bccfd7d7f1915599bbcc90e49d9fccfcb0004b7c62a2f5cdf0f96a09d6a3e鈥?;;
i386) goRelArch=鈥榣inux-386鈥? goRelSha256=鈥?7b2c4e26bd3a82a0a44499ae2d36e3f2155d0fe2f6b9a14ac6b7c5afac3ca6a鈥?;;
ppc64el) goRelArch=鈥榣inux-ppc64le鈥? goRelSha256=鈥?eb4c84e7b6aa9edb966c467dd6764d131a57d27afbd87cc8f6d10535df9e898鈥?;;
s390x) goRelArch=鈥榣inux-s390x鈥? goRelSha256=鈥榗b1f2d001ce15e51f7c4bd43f15045ea23d49268010bb981110242a532138749鈥?;;
*) goRelArch=鈥榮rc鈥? goRelSha256=鈥?3fc9d781815d411928eccb92bf20d5b4264797be69410eac854babe44c94c09鈥?
echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;;
esac;
url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz";
wget -O go.tgz "$url" --progress=dot:giga;
echo "${goRelSha256} *go.tgz" | sha256sum -c -;
tar -C /usr/local -xzf go.tgz;
rm go.tgz;
# https://github.com/golang/go/issues/38536#issuecomment-616897960
if [ "$goRelArch" = 鈥榮rc鈥?]; then
savedAptMark="$(apt-mark showmanual)";
apt-get update;
apt-get install -y --no-install-recommends golang-go;
goEnv="$(go env | sed -rn -e 鈥?^GO(OS|ARCH|ARM|386)=/s//export /p鈥?";
eval "$goEnv";
[ -n "$GOOS" ];
[ -n "$GOARCH" ];
(
cd /usr/local/go/src;
./make.bash;
);
apt-mark auto 鈥?*鈥?> /dev/null;
apt-mark manual $savedAptMark > /dev/null;
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false;
rm -rf /var/lib/apt/lists/*;
# pre-compile the standard library, just like the official binary release tarballs do
go install std;
# go install: -race is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64, darwin/amd64 and windows/amd64
# go install -race std;
# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain
rm -rf
/usr/local/go/pkg/*/cmd
/usr/local/go/pkg/bootstrap
/usr/local/go/pkg/obj
/usr/local/go/pkg/tool/*/api
/usr/local/go/pkg/tool/*/go_bootstrap
/usr/local/go/src/cmd/dist/dist
;
fi;
go version
?
ENV GOPATH /go
ENV PATH $GOPATH/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH