Skip to content

Commit b6e8b8e

Browse files
committed
ghcr integration
1 parent cb9bbb1 commit b6e8b8e

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ jobs:
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:
@@ -49,8 +63,11 @@ jobs:
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 }}

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.19-alpine AS builder
1+
FROM golang:1.21-alpine AS builder
22

33
WORKDIR /workspace
44

@@ -7,7 +7,8 @@ COPY go.mod go.mod
77
COPY 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
1314
COPY cmd/ cmd/
@@ -20,7 +21,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager cmd/main.go
2021
RUN 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)
2627
RUN apk --no-cache add iproute2

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/johnlam90/aws-multi-eni-controller
22

3-
go 1.23
4-
5-
toolchain go1.23.8
3+
go 1.21
64

75
require (
86
github.com/aws/aws-sdk-go v1.44.234

0 commit comments

Comments
 (0)