fix: add support for alpine image and using either podman or buildah

This commit is contained in:
Gerald Pinder 2023-12-28 16:28:34 -05:00
parent 6c61cab07e
commit 3b07758709
5 changed files with 178 additions and 153 deletions

View file

@ -1,13 +1,13 @@
VERSION --global-cache 0.7
IMPORT github.com/earthly/lib/rust AS rust
ARG FEDORA_MAJOR_VERSION=38
FROM registry.fedoraproject.org/fedora-toolbox:${FEDORA_MAJOR_VERSION}
ARG --global FEDORA_MAJOR_VERSION=38
ARG --global IMAGE=registry.gitlab.com/wunker-bunker/ublue-cli
iso-generator:
FROM registry.fedoraproject.org/fedora-toolbox:${FEDORA_MAJOR_VERSION}
GIT CLONE https://github.com/ublue-os/isogenerator.git /isogenerator
WORKDIR /isogenerator
ARG PACKAGES=$(cat deps.txt)
@ -15,6 +15,10 @@ iso-generator:
SAVE IMAGE --push $IMAGE/iso-generator
cosign:
FROM gcr.io/projectsigstore/cosign
SAVE ARTIFACT /ko-app/cosign
install:
FROM rust
DO rust+INIT --keep_fingerprints=true
@ -22,14 +26,19 @@ install:
COPY --keep-ts . /app
WORKDIR /app
DO rust+CARGO --args="build --release" --output="release/[^\./]+"
ARG --required TARGET
DO rust+CARGO --args="build --release --target $TARGET" --output="$TARGET/release/[^\./]+"
SAVE ARTIFACT target/release/ublue
SAVE ARTIFACT target/$TARGET/release/ublue
ublue-cli:
BUILD +install
FROM registry.fedoraproject.org/fedora-toolbox:${FEDORA_MAJOR_VERSION}
BUILD +install --TARGET="x86_64-unknown-linux-gnu"
COPY +install/ublue /usr/bin/ublue
RUN dnf install --refresh -y buildah podman skopeo
COPY +cosign/cosign /usr/bin/cosign
COPY (+install/ublue --TARGET="x86_64-unknown-linux-gnu") /usr/bin/ublue
ARG TAG
IF [ "$TAG" != "" ]
@ -40,8 +49,33 @@ ublue-cli:
IF [ "$LATEST" = "true" ]
SAVE IMAGE --push $IMAGE:latest
END
ELSE
SAVE IMAGE ublue-cli
END
ublue-cli-alpine:
FROM alpine
BUILD +install --TARGET="x86_64-unknown-linux-musl"
RUN apk update && apk add buildah podman skopeo fuse-overlayfs
COPY +cosign/cosign /usr/bin/cosign
COPY (+install/ublue --TARGET="x86_64-unknown-linux-musl") /usr/bin/ublue
ARG TAG
IF [ "$TAG" != "" ]
SAVE IMAGE --push $IMAGE:$TAG-alpine
ARG LATEST=false
IF [ "$LATEST" = "true" ]
SAVE IMAGE --push $IMAGE:alpine
END
ELSE
SAVE IMAGE ublue-cli:alpine
END
all:
BUILD +ublue-cli
BUILD +ublue-cli-alpine
BUILD +iso-generator