I had a question, which basically was just a mirror of an issue previously asked:
I find the syntax of Earthfiles really appealing, and the re-usability/composability aspect of being able to reference other files. I'm not super familiar with Docker internals, but when it comes to copying artifacts, like binaries or static assets, isn't that the same as the COPY
command or using the multi-stage build in Docker?
Often times I find myself needing multiple languages in a Docker project to compile binaries, which then just get copied over as an asset, and I was wondering if there were some unique features that Earthly had compared to Docker with this.
v0.2.0
is out! Includes some fixes related to "out of disk space" error, renames build.earth
to Earthfile
, introduces a config file and many other goodies. Full details on the releases page: https://github.com/earthly/earthly/releases/tag/v0.2.0
v0.3
is out! It includes a new interactive mode (-i
) where it drops you in a shell if the build fails. It also adds support for Dockerfiles (FROM DOCKERFILE
). Mac builds are now almost 3x faster (!!). And many other goodies! https://github.com/earthly/earthly/releases
Hi Earthly team!
Question - what's the earth/earthly philosophy around conditional logic for specific commit refs? Do I just have conditional logic in my CI?
For example:
I do realize that I could just have a separate target that publishes assets, like for docker assets I could invoke SAVE IMAGE
and have a separate publish
target where I invoke SAVE IMAGE --push ...
.
I'm curious how the earthly team recommends I accomplish this with earth. If possible, I'd like as little logic in my CI as possible.
@vladaionescu got it working :)
one interesting thing I noticed / is expected: I packaged my application as a .deb and installed it into the openjdk-8 debian image, and now I essentially have an image twice the size, as the docker layer has my .deb and the results of installation. Is there a trick in earthly to either copy and install my .deb in one line (to avoid the duplicate layers) or to squash layers?
I believe I found a bug with the EARTHLY_SECRETS
env var: earthly/earthly#229
lmk if i'm just doing it wrong, thanks.
v0.3.2
is out! Bash autocomplete, new syntax for docker operations (WITH DOCKER
), support for generated dockerfiles and a number of bug fixes. More info here https://github.com/earthly/earthly/releases/tag/v0.3.2
v0.3.5
is out! It features target aware completion for bash and zsh and a couple bug fixes. More details here https://github.com/earthly/earthly/releases/tag/v0.3.5
any ideas why this might happen?
ERROR: (helper image for fake dep operations) failed to authorize: failed to fetch anonymous token: context canceled
Error: solve side effects: solve: failed to solve: rpc error: code = Canceled desc = failed to load cache key: failed to authorize: failed to fetch anonymous token: context canceled
0.3.6
is out. We now have an --ssh flag available on the RUN
command https://github.com/earthly/earthly/releases/tag/v0.3.6
drain
target. The $(HOME)
variable I would love to interpolate to my machine's home /Users/sebastianradloff
. Is there a recommended way to do this?FROM planetlabs/draino:450a853
build:
USER root
RUN apk add \
--update \
--no-cache \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
aws-cli
SAVE IMAGE local-draino
drain:
FROM docker:19.03.13-dind
WITH DOCKER
DOCKER LOAD +build local-draino
RUN docker run --rm -v $(HOME)/kube:/root/.kube --entrypoint cat --rm local-draino /root/.kube/config
END
hey team, i'm finally playing with the RUN --ssh
feature to download private repo go dependencies, and I'm getting an error, but confirmed that from my host machine i can run go mod vendor
. I'm on earth version v0.3.8.
what I tried:
RUN --ssh git config --global url."git@github.com:".insteadOf "https://github.com/" && go mod vendor
What I get back:
+build-base | --> RUN git config --global url."git@github.com:".insteadOf "https://github.com/" && go mod vendor
+build-base | go: github.com/namely/go-common@v1.5.4: reading github.com/namely/go-common/go.mod at revision v1.5.4: unknown revision v1.5.4
+build-base | Command /bin/sh -c 'git config --global url."git@github.com:".insteadOf "https://github.com/" && go mod vendor' failed with exit code 1
+build-base | +build-base | ERROR: Command exited with non-zero code: RUN git config --global url."git@github.com:".insteadOf "https://github.com/" && go mod vendor
Repeating the output of the command that caused the failure
=========================== FAILURE ===========================
HI all, pretty new to Earthly and am working through an issue that I could use some help with. Im trying to create a github action to push our image to AWS ECR.
RUN aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin xxxxxx.dkr.ecr.us-east-1.amazonaws.com
t
That's the code that Im using to try to login to ECR and then to the docker repo.
The error that I'm getting is: +build-package failed | /bin/sh: 1: docker: not found
+build-package failed | /bin/sh: 1: aws: not found
So I guess the meat of my question is how do I ensure that those are available to earthly?
.earthignore
could help me :)
Hi all, noticed that one of our pipelines breaks now in v0.3.14 (was working on v0.3.11). We have a target called +docker-build
that accepts a SERVICE
argument, and we use that to build several downstream docker images like so:
docker-build:
...
ARG VERSION=dev
ARG SERVICE
COPY --chown namely:root +docker-stage/${SERVICE} .
SAVE IMAGE --push registry.namely.land/namely/image-$SERVICE:$VERSION
docker-build-all:
BUILD --build-arg SERVICE=A +docker-build
BUILD --build-arg SERVICE=B +docker-build
and now we get the following error:
+docker-build | ERROR: (COPY +docker-stage/${SERVICE} .) "/${SERVICE}" not found: not found
thoughts?
Hello I am getting this error:
Error: --allow-privileged (-P) flag is required
when using docker. This is my build step:
test-all:
FROM +code
COPY docker-compose.test.yml ./docker-compose.yml
WITH DOCKER --pull postgres
RUN docker-compose up -d && \
for i in {1..30}; do nc -z localhost 5432 && break; sleep 1; done; \
sbt coverage test coverageAggregate && \
docker-compose down
END
Hey everyone :wave:
We've been working on a new feature in Earthly which allows you to share build :key: secrets with your team.
It's fresh out of the oven in v0.3.19
and we're super curious what you think. Come over to #cloud-secrets
channel on our Slack to give us feedback. Instructions on how to use the feature are linked in that channel.
--secret x=y
in CI to propagate CI secrets into Earthly secrets. You can now place secrets directly into Earthly's cloud secret store..env
files that need to be passed around between developers, it might be easier to manage centrally in the cloud secret store.All this ultimately helps make builds that much more repeatable!
Hi, I realize that you can use FROM
and a WORKDIR
at the top of the file for other targets to use.
I wonder, what other options can be inherited from definition at the top of the file by other targets?
More specifically, I was hoping that ARG can be shared, similar to what is described in the dockerfile reference - https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact.
accordingly, here is an example Earthfile:
ARG TST="hello world"
FROM golang:1.13-alpine3.11
test-target:
ARG TST
RUN echo $TST
I was hoping earth +test-target
would print the var.
Thanks!
Hi! Is there an idiomatic way of handling artifact versions? The result of a build usually has the version as part of the name of the artifact.
Looking at https://github.com/earthly/earthly/blob/main/examples/scala/Earthfile, the version is hardcoded, which means the earthfile would need a manual update each time the version changes in the build system's config.
Outside of extracting the version by whatever means and then passing it as an ARG to earthly, is there any other recommended way of handling this? Extracting the version before calling earth
usually means bash, which is what we're trying to avoid. Extra scripting glue between the CI and the image builds.
Something I'm not getting to the bottom of: When using a private repo in FROM
, earth
seems to hang indefinitely. i.e.
+base | --> FROM private-repo.corp.com/team/component-base:latest
+base | resolve private-repo.corp.com/team/component-base:latest@sha256:aeb6a8acda114643929f631b1b8dc754823d4a7dfaf3b85c12172f096d12f83a 100%
The layer is resolved (the hash is there), but it just hangs. Currently it's going on 30 mins+. If I run a docker build
using a FROM private-repo.corp.com/team/component-base:latest
it runs w/o a problem, taking around 90 seconds to download the base from the remote. Any idea what's happening or how I can debug it?
earth +all
for https://github.com/earthly/earthly/blob/main/examples/tests/build-arg.earth - and it does fail with +test-global1 | Command /bin/sh -c 'test "$global1" == "abc"' failed with exit code 1
- is this a known issue?
earth
has been renamed to earthly
Hi all,
I'm wondering if there is a way to use a command output string as a sort of an artifact or argument.
For example, what I'm interested in doing is finding the go version used in my module (go list -m -f '{{.GoVersion}}'
) and accordingly use the right go image in another target to test, build etc:
FROM golang:${GO_VERSION}-alpine
where GO_VERSION
would be the output/artifact from the previous command.
Thank you!