File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 - name : Set up Docker Buildx
2727 uses : docker/setup-buildx-action@v3
2828
29+ - name : Check Go version in Dockerfile and go.mod
30+ run : |
31+ echo "Checking Go version in Dockerfile..."
32+ GO_VERSION_DOCKERFILE=$(grep "FROM golang:" Dockerfile | head -1 | cut -d':' -f2 | cut -d'-' -f1)
33+ echo "Go version in Dockerfile: $GO_VERSION_DOCKERFILE"
34+
35+ echo "Checking Go version in go.mod..."
36+ GO_VERSION_GOMOD=$(grep "^go " go.mod | awk '{print $2}')
37+ echo "Go version in go.mod: $GO_VERSION_GOMOD"
38+
39+ if [[ "$GO_VERSION_DOCKERFILE" != "$GO_VERSION_GOMOD" ]]; then
40+ echo "Warning: Go version mismatch between Dockerfile ($GO_VERSION_DOCKERFILE) and go.mod ($GO_VERSION_GOMOD)"
41+ fi
42+
2943 - name : Log in to the Container registry
3044 uses : docker/login-action@v3
3145 with :
4963
5064 - name : Build and push Docker image
5165 uses : docker/build-push-action@v5
66+ env :
67+ DOCKER_BUILDKIT : 1
5268 with :
5369 context : .
70+ file : ./Dockerfile
5471 push : true
5572 tags : ${{ steps.meta.outputs.tags }}
5673 labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change 1- FROM golang:1.19 -alpine AS builder
1+ FROM golang:1.21 -alpine AS builder
22
33WORKDIR /workspace
44
@@ -7,7 +7,8 @@ COPY go.mod go.mod
77COPY go.sum go.sum
88
99# Cache dependencies
10- RUN go mod download
10+ # Remove any toolchain directive for compatibility with older Go versions
11+ RUN sed -i '/^toolchain/d' go.mod && go mod download
1112
1213# Copy the source code
1314COPY cmd/ cmd/
@@ -20,7 +21,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager cmd/main.go
2021RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o eni-manager cmd/eni-manager/main.go
2122
2223# Use a minimal base image for the final image
23- FROM alpine:3.16
24+ FROM alpine:3.19
2425
2526# Install iproute2 for the ip command (used as fallback by ENI Manager)
2627RUN apk --no-cache add iproute2
Original file line number Diff line number Diff line change 11module github.com/johnlam90/aws-multi-eni-controller
22
3- go 1.23
4-
5- toolchain go1.23.8
3+ go 1.21
64
75require (
86 github.com/aws/aws-sdk-go v1.44.234
You can’t perform that action at this time.
0 commit comments