flyctl icon indicating copy to clipboard operation
flyctl copied to clipboard

--ignorefile option is ignored when using a custom build context with `fly deploy`

Open jgoux opened this issue 1 year ago • 3 comments

When using a custom build context with fly deploy, the --ignorefile flag isn't taken into account when calling:

fly deploy ../.. --config apps/proxy/fly.toml --ignorefile apps/proxy/.dockerignore --dockerfile apps/proxy/Dockerfile

I also tried setting these options in my fly.toml file with this command:

fly deploy ../.. --config apps/proxy/fly.toml
app = 'my-app'

[build]
dockerfile = "Dockerfile"
ignorefile = ".dockerignore"

The Dockerfile is found by the .dockerignore is once again ignored.

The only way to make it works is to copy my .dockerignore file to the root folder:

cp .dockerignore ../.. && fly deploy ../.. --config apps/proxy/fly.toml && rm ../../.dockerignore

Fly version: fly v0.2.114 darwin/arm64 Commit: de9e822f435d145ba4def9ef63cb94a35383b461 BuildDate: 2024-08-16T13:33:06Z

jgoux avatar Aug 19 '24 14:08 jgoux

flyctl v0.3.75 it's still not fixed 🤦‍♂️

dannylin108 avatar Mar 02 '25 10:03 dannylin108

Sorry for the breakage. We have switched our build process to use Buildkit natively instead of using Docker's legacy build API in 2023. However it makes supporting this option hard for us. Previously flyctl was responsible for creating a build context (a tarball of your directory, without what dockerignore has). But with Buildkit, Buildkit’s client is responsible for reading dockerignore files.

Buildkit supports the following naming convention. Would it work for you?

https://docs.docker.com/build/concepts/context/#filename-and-location

I'm planning to update flyctl to show an error if ignorefile is specified.

kzys avatar Mar 13 '25 21:03 kzys

Buildkit supports the following naming convention. Would it work for you?

https://docs.docker.com/build/concepts/context/#filename-and-location

yes, it works perfectly well. thanks a lot!

dannylin108 avatar Mar 14 '25 01:03 dannylin108