File tree Expand file tree Collapse file tree 2 files changed +43
-8
lines changed Expand file tree Collapse file tree 2 files changed +43
-8
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,44 @@ ARG BUILDER_IMAGE
1818FROM  ${BUILDER_IMAGE} as builder
1919WORKDIR  /workspace
2020
21+ #  Install dependencies for building Go from source
22+ RUN  apt-get update && apt-get install -y \
23+     build-essential \
24+     curl \
25+     git \
26+     ca-certificates \
27+     && rm -rf /var/lib/apt/lists/*
28+ 
29+ #  Download and build Go from source
30+ ARG  GO_VERSION
31+ 
32+ #  Download and install bootstrap Go (binary)
33+ ARG  BOOTSTRAP_GO_VERSION=1.24.7
34+ ARG  TARGETARCH
35+ RUN  echo "Installing bootstrap Go version: ${BOOTSTRAP_GO_VERSION} (${TARGETARCH})"  && \
36+     curl -fsSL "https://go.dev/dl/go${BOOTSTRAP_GO_VERSION}.linux-${TARGETARCH}.tar.gz"  -o /tmp/go-bootstrap.tar.gz && \
37+     tar -xzf /tmp/go-bootstrap.tar.gz -C /usr/local && \
38+     mv /usr/local/go /usr/local/go-bootstrap && \
39+     rm /tmp/go-bootstrap.tar.gz
40+ 
41+ #  Download Go source
42+ RUN  echo "Downloading Go source version: ${GO_VERSION}"  && \
43+     curl -fsSL "https://go.dev/dl/go${GO_VERSION}.src.tar.gz"  -o /tmp/go.src.tar.gz && \
44+     tar -xzf /tmp/go.src.tar.gz -C /usr/local && \
45+     rm /tmp/go.src.tar.gz
46+ 
47+ #  Build Go from source with bootstrap
48+ WORKDIR  /usr/local/go/src
49+ ENV  GOROOT_BOOTSTRAP=/usr/local/go-bootstrap
50+ RUN  ./make.bash
51+ 
52+ #  Set up Go environment
53+ ENV  PATH=/usr/local/go/bin:$PATH
54+ ENV  GOROOT=/usr/local/go
55+ ENV  GOPATH=/workspace/gopath
56+ 
2157#  Copy the sources
58+ WORKDIR  /workspace
2259COPY  ./go-runner.go ./
2360COPY  ./go.* ./
2461
@@ -38,11 +75,8 @@ ENV GOPROXY="https://proxy.golang.org|direct"
3875
3976#  Build
4077ARG  package=.
41- ARG  ARCH
4278
4379ENV  CGO_ENABLED=0
44- ENV  GOOS=linux
45- ENV  GOARCH=${ARCH}
4680
4781RUN  go env
4882
Original file line number Diff line number Diff line change @@ -17,15 +17,15 @@ include $(CURDIR)/../../Makefile.common-image
1717
1818IMGNAME  = go-runner
1919APP_VERSION  = $(shell  cat VERSION) 
20- GO_MAJOR_VERSION  ?= 1.24 
20+ GO_MAJOR_VERSION  ?= 1.25 
2121REVISION  ?= 0
22- GO_VERSION  ?= 1.24.6 
23- OS_CODENAME  ?= bookworm
22+ GO_VERSION  ?= 1.25.1 
23+ OS_CODENAME  ?= bookworm-slim 
2424
2525#  Build args
2626DISTROLESS_REGISTRY  ?= gcr.io/distroless
2727DISTROLESS_IMAGE  ?= static-debian12
28- BUILDER_IMAGE  ?= golang: $( GO_VERSION ) - $(OS_CODENAME ) 
28+ BUILDER_IMAGE  ?= debian: $(OS_CODENAME ) 
2929
3030#  Configuration
3131CONFIG  = go$(GO_MAJOR_VERSION ) -$(OS_CODENAME ) 
5353	rm go-runner
5454
5555BUILD_ARGS  = --build-arg=BUILDER_IMAGE=$(BUILDER_IMAGE )  \ 
56-              --build-arg=DISTROLESS_IMAGE=$(DISTROLESS_REGISTRY ) /$(DISTROLESS_IMAGE ) 
56+              --build-arg=DISTROLESS_IMAGE=$(DISTROLESS_REGISTRY ) /$(DISTROLESS_IMAGE )  \ 
57+              --build-arg=GO_VERSION=$(GO_VERSION ) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments