diff --git a/Dockerfile b/Dockerfile index 7ff4b72..4c0b871 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,10 @@ RUN go get -d -v ARG VERSION ENV VERSION ${VERSION:-0.1.0} -RUN GOOS=linux GOARCH=amd64 go build -v -ldflags "-X main.Version=${VERSION} -s -w" +ARG CGO_ENABLED +ENV CGO_ENABLED ${CGO_ENABLED:-1} + +RUN CGO_ENABLED=${CGO_ENABLED} GOOS=linux GOARCH=amd64 go build -v -ldflags "-X main.Version=${VERSION} -s -w" FROM ${BASE_IMAGE} as exporter LABEL org.opencontainers.image.authors="Seth Miller,Yannig Perré " diff --git a/Makefile b/Makefile index c42d50c..10863a0 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ RELEASE ?= true UBUNTU_BASE_IMAGE ?= docker.io/library/ubuntu:24.04 ORACLE_LINUX_BASE_IMAGE ?= docker.io/library/oraclelinux:9-slim ALPINE_BASE_IMAGE ?= docker.io/library/alpine:3.19 +SCRATCH_BASE_IMAGE ?= scratch ifeq ($(GOOS), windows) EXT?=.exe @@ -92,12 +93,13 @@ go-test: clean: rm -rf ./dist sgerrand.rsa.pub glibc-*.apk oracle-*.rpm -docker: ubuntu-image alpine-image oraclelinux-image +docker: ubuntu-image alpine-image oraclelinux-image scratch-image push-images: @make --no-print-directory push-ubuntu-image @make --no-print-directory push-oraclelinux-image @make --no-print-directory push-alpine-image + @make --no-print-directory push-scratch-image oraclelinux-image: if DOCKER_CLI_EXPERIMENTAL=enabled $(DOCKER_CMD) manifest inspect "$(IMAGE_ID)-oraclelinux" > /dev/null; then \ @@ -168,4 +170,26 @@ else @echo "Can't find cosign.key file" endif +scratch-image: + if DOCKER_CLI_EXPERIMENTAL=enabled $(DOCKER_CMD) manifest inspect "$(IMAGE_ID)-scratch" > /dev/null; then \ + echo "Image \"$(IMAGE_ID)-scratch\" already exists on ghcr.io"; \ + else \ + $(DOCKER_CMD) build --progress=plain $(BUILD_ARGS) -t "$(IMAGE_ID)-scratch" --build-arg BASE_IMAGE=$(SCRATCH_BASE_IMAGE) --build-arg CGO_ENABLED=0 . && \ + $(DOCKER_CMD) build --progress=plain $(BUILD_ARGS) $(LEGACY_TABLESPACE) --build-arg BASE_IMAGE=$(SCRATCH_BASE_IMAGE) --build-arg CGO_ENABLED=0 -t "$(IMAGE_ID)-scratch_legacy-tablespace" . && \ + $(DOCKER_CMD) tag "$(IMAGE_ID)-scratch" "$(IMAGE_NAME):scratch"; \ + fi + +push-scratch-image: + $(DOCKER_CMD) push $(IMAGE_ID)-scratch +ifeq ("$(RELEASE)", "true") + $(DOCKER_CMD) push "$(IMAGE_NAME):scratch" +endif + +sign-scratch-image: +ifneq ("$(wildcard cosign.key)","") + cosign sign --key cosign.key $(IMAGE_ID)-scratch +else + @echo "Can't find cosign.key file" +endif + .PHONY: version build deps go-test clean docker diff --git a/README.md b/README.md index 036df3a..49a1b36 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ Different Linux Distros: - `x.y.z` - Ubuntu Linux image - `x.y.z-oraclelinux` - Oracle Enterprise Linux image - `x.y.z-Alpine` - Alpine Linux image +- `x.y.z-scratch` - Scratch image Forked Version: All the above docker images have a duplicate image tag ending in @@ -450,6 +451,10 @@ Or Alpine: make alpine-image +Or Scratch: + + make scratch-image + ### Building Binaries Run build: