Unverified Commit 51b4cd7e authored by Julien Mancuso's avatar Julien Mancuso Committed by GitHub
Browse files

feat: replace Earthly (#2154)


Signed-off-by: default avatarJulien Mancuso <jmancuso@nvidia.com>
parent 5fc0bf92
...@@ -13,6 +13,14 @@ ...@@ -13,6 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
#######################################################################
# 🚨 DEPRECATION NOTICE 🚨
#
# This Earthfile is being replaced by docker
# This file is kept temporarily for backward compatibility but will
# be removed in a future release. Please migrate to the new system.
#######################################################################
VERSION 0.8 VERSION 0.8
############### ARTIFACTS TARGETS ############################## ############### ARTIFACTS TARGETS ##############################
......
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Base stage - Common setup for all stages
FROM golang:1.24 AS base
# Docker buildx automatically provides these
ARG TARGETOS=linux
ARG TARGETARCH=amd64
RUN echo "Building for ${TARGETOS}/${TARGETARCH}"
# Install common dependencies
RUN apt-get update && apt-get install -y git && apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy go mod and sum files first for better layer caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Lint stage
FROM base AS linter
# Install golangci-lint using go install (builds with current Go version)
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2
# Run linting
RUN golangci-lint run --timeout=5m
# Test stage
FROM base AS tester
# Install make if not present
RUN apt-get update && apt-get install -y make && apt-get clean && rm -rf /var/lib/apt/lists/*
# Run tests using Makefile
RUN make test
# Build stage - depends on successful lint and test
FROM base AS builder
# Build the binary
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o manager ./cmd/main.go
# Runtime stage
FROM nvcr.io/nvidia/distroless/go:v3.1.12
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532
ENTRYPOINT ["./manager"]
...@@ -13,6 +13,14 @@ ...@@ -13,6 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
#######################################################################
# 🚨 DEPRECATION NOTICE 🚨
#
# This Earthfile for the operator is being replaced by docker
# This file is kept temporarily for backward compatibility but will
# be removed in a future release. Please migrate to the new system.
#######################################################################
VERSION 0.8 VERSION 0.8
# Base container for both build and test # Base container for both build and test
......
...@@ -100,7 +100,15 @@ export IMAGE_TAG=${RELEASE_VERSION} ...@@ -100,7 +100,15 @@ export IMAGE_TAG=${RELEASE_VERSION}
# 2. Build operator # 2. Build operator
cd deploy/cloud/operator cd deploy/cloud/operator
earthly --push +docker --DOCKER_SERVER=$DOCKER_SERVER --IMAGE_TAG=$IMAGE_TAG
# 2.1 Alternative 1 : Build and push the operator image for multiple platforms
docker buildx create --name multiplatform --driver docker-container --bootstrap
docker buildx use multiplatform
docker buildx build --platform linux/amd64,linux/arm64 -t $DOCKER_SERVER/dynamo-operator:$IMAGE_TAG --push .
# 2.2 Alternative 2 : Build and push the operator image for a single platform
docker build -t $DOCKER_SERVER/dynamo-operator:$IMAGE_TAG . && docker push $DOCKER_SERVER/dynamo-operator:$IMAGE_TAG
cd - cd -
# 3. Create namespace and secrets to be able to pull the operator image # 3. Create namespace and secrets to be able to pull the operator image
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment