From e4d4b1cdecb2d665bdeaa49dd5e8b39f47372fea Mon Sep 17 00:00:00 2001 From: GuangJie1 Date: Mon, 22 Jul 2024 19:22:18 +0800 Subject: [PATCH] golang: support version 1.22.1 on openeuler 22.03 --- go/1.21.1/22.03-lts-sp3/Dockerfile | 34 ++++++++++++++++++++++++++++++ go/1.22.5/22.03-lts-sp4/Dockerfile | 20 ++++++++++-------- go/README.md | 2 -- go/meta.yml | 2 ++ 4 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 go/1.21.1/22.03-lts-sp3/Dockerfile diff --git a/go/1.21.1/22.03-lts-sp3/Dockerfile b/go/1.21.1/22.03-lts-sp3/Dockerfile new file mode 100644 index 00000000..c4220cd7 --- /dev/null +++ b/go/1.21.1/22.03-lts-sp3/Dockerfile @@ -0,0 +1,34 @@ +ARG BASE=openeuler/openeuler:22.03-lts-sp3 +FROM ${BASE} + +ARG TARGETARCH +ARG LOCAL_PATH=/usr/local + +ENV GOPATH=/go +ENV GOTOOLCHAIN=local +ENV GOLANG_VERSION=1.21.1 +ENV GOROOT=$LOCAL_PATH/go +ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH + +RUN set -eux; \ + yum update -y && yum -y install g++ gcc glibc-devel make pkg-config findutils ca-certificates && yum clean all; \ + curl -fSL -o ${LOCAL_PATH}/go.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.linux-${TARGETARCH}.tar.gz; \ + tar -xvf ${LOCAL_PATH}/go.tar.gz -C ${LOCAL_PATH}; \ + rm -f ${LOCAL_PATH}/go.tar.gz + +RUN set -eux; \ + find ${GOROOT}/src -exec touch -r ${GOROOT}/VERSION "{}" \; && \ + touch ${GOROOT}/pkg; \ + find ${GOROOT}/pkg -exec touch -r ${GOROOT}/pkg "{}" \; && \ + mkdir -p ${GOROOT}/bin/linux_${TARGETARCH}; \ + ln -sf ${GOROOT}/bin/go ${GOROOT}/bin/linux_${TARGETARCH}/go; \ + ln -sf ${GOROOT}/bin/gofmt ${GOROOT}/bin/linux_${TARGETARCH}/gofmt + +RUN mkdir -p "$GOPATH/src" "$GOPATH/bin"; \ + chmod -R 1777 "$GOPATH"; \ + yum -y remove g++ gcc glibc-devel make pkg-config findutils; \ + yum clean all + +WORKDIR $GOPATH + +CMD ["go", "version"] \ No newline at end of file diff --git a/go/1.22.5/22.03-lts-sp4/Dockerfile b/go/1.22.5/22.03-lts-sp4/Dockerfile index 90b033e1..b2006522 100644 --- a/go/1.22.5/22.03-lts-sp4/Dockerfile +++ b/go/1.22.5/22.03-lts-sp4/Dockerfile @@ -7,8 +7,8 @@ ARG LOCAL_PATH=/usr/local ENV GOPATH=/go ENV GOTOOLCHAIN=local ENV GOLANG_VERSION=1.22.5 -ENV GO_ROOT=${LOCAL_PATH}/go -ENV PATH=$GOPATH/bin:$GO_ROOT/bin:$PATH +ENV GOROOT=${LOCAL_PATH}/go +ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH RUN set -eux; \ yum update -y && yum -y install g++ gcc glibc-devel make pkg-config findutils && yum clean all; \ @@ -17,15 +17,17 @@ RUN set -eux; \ rm -f ${LOCAL_PATH}/go.tar.gz RUN set -eux; \ - find ${GO_ROOT}/src -exec touch -r ${GO_ROOT}/VERSION "{}" \; && \ - touch ${GO_ROOT}/pkg; \ - find ${GO_ROOT}/pkg -exec touch -r ${GO_ROOT}/pkg "{}" \; && \ - mkdir -p ${GO_ROOT}/bin/linux_${TARGETARCH}; \ - ln -sf ${GO_ROOT}/bin/go ${GO_ROOT}/bin/linux_${TARGETARCH}/go; \ - ln -sf ${GO_ROOT}/bin/gofmt ${GO_ROOT}/bin/linux_${TARGETARCH}/gofmt + find ${GOROOT}/src -exec touch -r ${GOROOT}/VERSION "{}" \; && \ + touch ${GOROOT}/pkg; \ + find ${GOROOT}/pkg -exec touch -r ${GOROOT}/pkg "{}" \; && \ + mkdir -p ${GOROOT}/bin/linux_${TARGETARCH}; \ + ln -sf ${GOROOT}/bin/go ${GOROOT}/bin/linux_${TARGETARCH}/go; \ + ln -sf ${GOROOT}/bin/gofmt ${GOROOT}/bin/linux_${TARGETARCH}/gofmt RUN mkdir -p "$GOPATH/src" "$GOPATH/bin"; \ - chmod -R 1777 "$GOPATH" + chmod -R 1777 "$GOPATH"; \ + yum -y remove g++ gcc glibc-devel make pkg-config findutils; \ + yum clean all WORKDIR $GOPATH diff --git a/go/README.md b/go/README.md index 86411330..a486dbb3 100644 --- a/go/README.md +++ b/go/README.md @@ -1,9 +1,7 @@ # Quick reference -- The official Go docker image. - The official Go docker image. -- Maintained by: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative). - Maintained by: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative). - Where to get help: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative), [openEuler](https://gitee.com/openeuler/community). diff --git a/go/meta.yml b/go/meta.yml index 88075f6d..4821e440 100644 --- a/go/meta.yml +++ b/go/meta.yml @@ -1,4 +1,6 @@ 1.17.3-oe2203lts: path: go/1.17.3/22.03-lts/Dockerfile +1.21.1-oe2203sp3: + path: go/1.21.1/22.03-lts-sp3/Dockerfile 1.22.5-oe2203sp4: path: go/1.22.5/22.03-lts-sp4/Dockerfile \ No newline at end of file -- Gitee