diff --git a/library/golang/1.19/Dockerfile b/library/golang/1.19/Dockerfile new file mode 100644 index 0000000..32dcc9c --- /dev/null +++ b/library/golang/1.19/Dockerfile @@ -0,0 +1,32 @@ +FROM lcr.loongnix.cn/library/buildpack-deps:scm + +# install cgo-related dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + g++ \ + gcc \ + libc6-dev \ + make \ + pkg-config \ + ; \ + apt-get autoclean all; \ + rm -rf /var/lib/apt/lists/* + +ENV PATH /usr/local/go/bin:$PATH + +ENV GOLANG_VERSION 1.19.11 + +RUN set -eux; \ + url='http://ftp.loongnix.cn/toolchain/golang/go-1.19/abi2.0/go1.19.11.linux-loong64.tar.gz'; \ + sha256='a2621ea9e658ac4cfc01e7bb3185d210b09a674fed7031f080e01ec06985b4e5'; \ + 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 + +ENV GOPATH /go +ENV PATH $GOPATH/bin:$PATH +RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" +WORKDIR $GOPATH diff --git a/library/golang/1.19/Makefile b/library/golang/1.19/Makefile new file mode 100644 index 0000000..c884068 --- /dev/null +++ b/library/golang/1.19/Makefile @@ -0,0 +1,28 @@ +# This file is generated by the template. + +REGISTRY ?=lcr.loongnix.cn +ORGANIZATION ?=library +REPOSITORY ?=golang +TAG ?=1.19 +LATEST ?=false + +IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) +LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest + +default: image + +image: + docker build \ + --build-arg http_proxy=$(http_proxy) \ + --build-arg https_proxy=$(https_proxy) \ + -t $(IMAGE) \ + . + +push: + docker push $(IMAGE) + #latest image + @if [ $(LATEST) = "true" ]; \ + then \ + docker tag $(IMAGE) $(LATEST_IMAGE); \ + docker push $(LATEST_IMAGE); \ + fi