Skip to content

ADD $FIREBIRD_RELEASE_URL /tmp/firebird-bundle.tar.gz increases the volume of containers. #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andreyrogojin opened this issue Mar 7, 2025 · 7 comments · May be fixed by #27
Open

Comments

@andreyrogojin
Copy link

I think it is possible to optimize the assembly of docker containers. Currently, the firebird installer is loaded by the ADD command into each container separately, while creating a layer in them that is not needed when using, but increases the volume of containers.
Maybe it would be better like this:

$ mkdir <path for all>/tmp
$ wget -O tmp/firebird-bundle.tar.gz https://github.com/FirebirdSQL/firebird/releases/download/v5.0.1/Firebird-5.0.1.1469-0-linux-x64.tar.gz

And exclude ADD in the dockerfiles, using instead:
RUN --mount=type=bind,from=<path for all>/tmp,dst=/tmp,rw set -eux; cd /tmp; tar --extract ...
You won't need to download the installer for each tag and the size of the containers will decrease.

@fdcastel
Copy link
Member

fdcastel commented Mar 7, 2025

Good catch, @andreyrogojin! I'll check it out in the next few days.

P.S.: PRs are welcome, if you are interested. 😉

@fdcastel
Copy link
Member

Sorry, guys. I'm stepping back from this one, for now.

The added complexities of maintaining both AMD64 and ARM64 scripts have proven too much to juggle right now.

I'm closing this case for the time being. If anyone else wants to take a crack at it, feel free to reopen and jump in.

@asfernandes
Copy link
Member

And exclude ADD in the dockerfiles, using instead:
RUN --mount=type=bind,from=<path for all>/tmp,dst=/tmp,rw set -eux; cd /tmp; tar --extract ...
You won't need to download the installer for each tag and the size of the containers will decrease.

If I understand, you said to use wget before docker build.

Why not just use wget in the RUN command?

@fdcastel
Copy link
Member

fdcastel commented May 23, 2025

If I understand, you said to use wget before docker build.

Why not just use wget in the RUN command?

Because that would end up downloading the files inside the container again? 😉

The main challenge here is ensuring the bundle files are available when install.sh is executed, without occupying additional layer space. For this I tried two different strategies:

1. Multi-stage builds

Initially, I tried to avoid downloading files on the host and instead keep everything self-contained within the container image. To do this, I turned to multi-stage builds.

Unfortunately, this approach quickly hit a roadblock: Docker doesn't support "mounting" a folder from one build stage into another (you can only COPY files between stages). And that brings us right back to the original problem.

2. Download the files on host (@andreyrogojin OP idea)

Downloading all bundles in docker host first, and then using RUN --mount=type=bind on Dockerfile was the next attempt.

But this ended up causing additional build issues, while also complicating the build scripts and polluting the Docker host.

Ultimately, I decided that the ~10% increase in image size wasn't significant enough to justify the hassle.😅

@asfernandes
Copy link
Member

Because that would end up downloading the files inside the container again?

If you download the file, extract, install and delete inside the same RUN command, it will not be stored as a layer.

@fdcastel
Copy link
Member

If you download the file, extract, install and delete inside the same RUN command, it will not be stored as a layer.

Damn... why didn’t anyone ever tell me that before? 😂

Alright, I’ll give it another shot tonight. Appreciate the insight!

@fdcastel
Copy link
Member

I gave it an initial try, but the image has actually increased in size. 😕

Let’s continue the discussion on #23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants