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
2 changes: 1 addition & 1 deletion library/golang/1.26-buster/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ IMAGE = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
ALIAS0 = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(GOMAJOR)
ALIAS1 = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(GOMAJOR).$(GOMINOR)-$(OSVERSION)
ALIAS2 = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(GOMAJOR).$(GOMINOR)
LATEST = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest
LATEST =

default: image

Expand Down
32 changes: 32 additions & 0 deletions library/golang/1.27-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.27.1

RUN set -eux; \
url='http://ftp.loongnix.cn/toolchain/golang/go-1.27/abi1.0/go1.27.1.linux-loong64.tar.gz'; \
sha256='e4f8920f59c1da3604fba3ff2d668e7ff607d74b4fd548230149e8c8e513dff8'; \
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


24 changes: 24 additions & 0 deletions library/golang/1.27-alpine/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is generated by the template.

REGISTRY ?= cr.loongnix.cn
ORGANIZATION ?= library
REPOSITORY ?= golang
GOMAJOR ?= 1.27
GOMINOR ?= 1
OSVERSION ?= alpine
TAG ?= $(GOMAJOR)-$(OSVERSION)

IMAGE = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
ALIAS0 = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(GOMAJOR).$(GOMINOR)-$(OSVERSION)

default: image

image:
docker build -t $(IMAGE) .

push: alias
docker push $(IMAGE)
docker push $(ALIAS0)

alias:
docker tag $(IMAGE) $(ALIAS0)
32 changes: 32 additions & 0 deletions library/golang/1.27-buster/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM cr.loongnix.cn/library/buildpack-deps:buster-scm

# install cgo-related dependencies
RUN set -eux; \
apt-get update; \
apt-get dist-upgrade -y; \
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 GOLANGVERSION 1.27.1

RUN set -eux; \
url='http://ftp.loongnix.cn/toolchain/golang/go-1.27/abi1.0/go1.27.1.linux-loong64.tar.gz'; \
sha256='e4f8920f59c1da3604fba3ff2d668e7ff607d74b4fd548230149e8c8e513dff8'; \
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
36 changes: 36 additions & 0 deletions library/golang/1.27-buster/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This file is generated by the template.

REGISTRY ?= cr.loongnix.cn
ORGANIZATION ?= library
REPOSITORY ?= golang
GOMAJOR ?= 1.27
GOMINOR ?= 1
OSVERSION ?= buster
TAG ?= $(GOMAJOR)-$(OSVERSION)

IMAGE = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
ALIAS0 = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(GOMAJOR)
ALIAS1 = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(GOMAJOR).$(GOMINOR)-$(OSVERSION)
ALIAS2 = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(GOMAJOR).$(GOMINOR)
LATEST = $(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest

default: image

image:
docker build -t $(IMAGE) .

push: alias
docker push $(IMAGE)
docker push $(ALIAS0)
docker push $(ALIAS1)
docker push $(ALIAS2)

ifneq ($(LATEST),)
docker tag $(IMAGE) $(LATEST)
docker push $(LATEST)
endif

alias:
docker tag $(IMAGE) $(ALIAS0)
docker tag $(IMAGE) $(ALIAS1)
docker tag $(IMAGE) $(ALIAS2)
Loading