Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions library/golang/1.26-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -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


18 changes: 18 additions & 0 deletions library/golang/1.26-alpine/Makefile
Original file line number Diff line number Diff line change
@@ -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)
Loading