Skip to content

Commit

Permalink
🐛 Fix +base-image for Remote Execution (#2808)
Browse files Browse the repository at this point in the history
Fix +base-image for Remote Execution

This does not work with remote execution today.  For example, if I made
a new `Earthfile` in a different repository that contained this:
```yaml
kairos-image:
    BUILD github.com/kairos-io/kairos:3.1.1+base-image \
        --BASE_IMAGE=ubuntu:24.04 \
        --BOOTLOADER=grub \
        --FAMILY=ubuntu \
        --FLAVOR=ubuntu \
        --FLAVOR_RELEASE=24.04 \
        --MODEL=generic \
        --VARIANT=standard
```
It will fail to build with:
```
g/k/kairos:v3.1.1+base-image | resolve build context for dockerfile: read build file: open images/+kairos-dockerfile/Dockerfile: no such file or directory
Error: async earthfile2llb for github.com/kairos-io/kairos:v3.1.1+base-image: /tmp/earthly-git3649441421/Earthfile:263:4 from dockerfile: resolve build context for dockerfile: read build file: open images/+kairos-dockerfile/Dockerfile: no such file or directory
in              github.com/kairos-io/kairos:v3.1.1+base-image --BASE_IMAGE=ghcr.io/marinatedconcrete/ubuntu-24-lts:latest --BOOTLOADER=grub --FAMILY=ubuntu --FLAVOR=ubuntu --FLAVOR_RELEASE=24.04 --FRAMEWORK_VERSION= --K3S_VERSION= --MODEL=generic --RELEASE= --SOFTWARE_VERSION_PREFIX= --TARGETARCH= --VARIANT=standard --_FRAMEWORK_VERSION= --_SOFTWARE_LUET_VERSION=
```

This change fixes it by using a saved artifact instead of directly
copying referencing the relative path.  This also aligns better with the
Earthly docs: https://docs.earthly.dev/docs/earthfile#from-dockerfile

Signed-off-by: Shawn Wilsher <[email protected]>
  • Loading branch information
sdwilsh authored Aug 21, 2024
1 parent 9fe855b commit 18f5586
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,13 @@ luet:
### Image Build targets
###

kairos-dockerfile-context:
COPY --dir images/ .
SAVE ARTIFACT images

kairos-dockerfile:
ARG --required FAMILY
COPY ./images .
COPY +kairos-dockerfile-context/images .
IF [ "$FAMILY" == "all" ]
ARG FAMILY_LIST="alpine debian opensuse rhel ubuntu"
ELSE
Expand Down Expand Up @@ -274,7 +278,7 @@ base-image:
--build-arg FRAMEWORK_VERSION=$_FRAMEWORK_VERSION \
--build-arg BOOTLOADER=$BOOTLOADER \
-f +kairos-dockerfile/Dockerfile \
./images
+kairos-dockerfile-context/images/*

ARG _CIMG=$(cat ./IMAGE)

Expand Down

0 comments on commit 18f5586

Please sign in to comment.