mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-25 21:43:58 +00:00
wrench: Add temp-image Earthly target (#876)
Add temp-image Earthly target This is helpful to quickly generate temp images and upload them to ttl.sh plus you can quickly distinguish the images by branch and sha Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
This commit is contained in:
28
Earthfile
28
Earthfile
@@ -672,3 +672,31 @@ docs:
|
||||
RUN npm run prepare
|
||||
RUN HUGO_ENV="production" hugo --gc -b "/local/" -d "public/local"
|
||||
SAVE ARTIFACT public /public AS LOCAL docs/public
|
||||
|
||||
## ./earthly.sh --push +temp-image --FLAVOR=ubuntu
|
||||
## all same flags than the `docker` target plus
|
||||
## - the EXPIRATION time, defaults to 24h
|
||||
## - the NAME of the image in ttl.sh, defaults to the branch name + short sha
|
||||
## the push flag is optional
|
||||
##
|
||||
## you will have access to an image in ttl.sh e.g. ttl.sh/add-earthly-target-to-build-temp-images-339dfc7:24h
|
||||
temp-image:
|
||||
FROM alpine
|
||||
RUN apk add git
|
||||
COPY . ./
|
||||
|
||||
IF [ "$EXPIRATION" = "" ]
|
||||
ARG EXPIRATION="24h"
|
||||
END
|
||||
|
||||
ARG BRANCH=$(git symbolic-ref --short HEAD)
|
||||
ARG SHA=$(git rev-parse --short HEAD)
|
||||
IF [ "$NAME" = "" ]
|
||||
ARG NAME="${BRANCH}-${SHA}"
|
||||
END
|
||||
|
||||
ARG TTL_IMAGE = "ttl.sh/${NAME}:${EXPIRATION}"
|
||||
|
||||
FROM +docker
|
||||
SAVE IMAGE --push $TTL_IMAGE
|
||||
|
||||
|
Reference in New Issue
Block a user