diff --git a/library/golang/1.26-alpine/Dockerfile b/library/golang/1.26-alpine/Dockerfile new file mode 100644 index 00000000..c3bc1854 --- /dev/null +++ b/library/golang/1.26-alpine/Dockerfile @@ -0,0 +1,32 @@ +FROM cr.loongnix.cn/library/alpine:3.11 + +RUN apk --no-cache upgrade +RUN apk add --no-cache ca-certificates wget + +# set up nsswitch.conf for Go's "netgo" implementation +# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275 +# - docker run --rm debian grep '^hosts:' /etc/nsswitch.conf +RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf + +ENV PATH /usr/local/go/bin:$PATH + +ENV GOLANG_VERSION 1.26.0 + +RUN set -eux; \ + url='https://ftp.loongnix.cn/toolchain/golang/go-1.26/abi1.0/go1.26.0.linux-loong64.tar.gz'; \ + sha256='f1225f07ed94fb9c83301b2abaf14306a0c3e0cc31f273bcba6d3e5b71293a4d'; \ + wget -O go.tgz "$url" --progress=dot:giga; \ + echo "$sha256 *go.tgz" | sha256sum -c -; \ + tar -C /usr/local -xzf go.tgz; \ + rm go.tgz; \ + go version + +RUN apk del wget + +ENV GOTOOLCHAIN=local +ENV GOPATH /go +ENV PATH $GOPATH/bin:$PATH +RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 1777 "$GOPATH" +WORKDIR $GOPATH + + diff --git a/library/golang/1.26-alpine/Makefile b/library/golang/1.26-alpine/Makefile new file mode 100644 index 00000000..981fc9bc --- /dev/null +++ b/library/golang/1.26-alpine/Makefile @@ -0,0 +1,18 @@ +# This file is generated by the template. + +REGISTRY ?= cr.loongnix.cn +ORGANIZATION ?= library +REPOSITORY ?= golang +TAG ?= 1.26-alpine + +IMAGE = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) + +default: image + +image: + docker build \ + -t $(IMAGE) \ + . + +push: + docker push $(IMAGE)