Skip to content

ioc: copy locally installed software from build stages.#55

Open
henriquesimoes wants to merge 1 commit intomainfrom
local
Open

ioc: copy locally installed software from build stages.#55
henriquesimoes wants to merge 1 commit intomainfrom
local

Conversation

@henriquesimoes
Copy link
Collaborator

Software, other than shared libraries, may be built in the first stages, but are currently not available in the resulting IOC image. Copy the entire /usr/local tree in all IOC stages, so that locally installed binaries and configuration can be usable at runtime.

This allows us to build custom versions of applications during build phases and install them at IOC images, centralizing and making it easier to track how they are built. In addition, IOCs can also install custom files which will be available at runtime in a known location. Still, IOCs themselves can also be installed in FHS-compliant paths inside the container as any other packaged software, allowing them to make use of tools based on system-installed artifacts (such as env executable discovery).

Dockerfile Outdated
FROM base AS no-build

COPY --from=build-image /opt /opt
COPY --from=build-image /usr/local /usr/local
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have scripts here which are only relevant for the image build phase? 🤔
Like lnls-get-n-unpack

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. But after-build stages wouldn't be aware of such things. We must remove everything (including lnls-get-n-unpack) beforehand if we don't want it to be in the final image, otherwise we won't shrink the image size (which is related to #19).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it makes sense to wait for #59 before merging this. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with it.

Extra software may be built in the first stages, but are currently not
available in the resulting IOC image. Copy the entire `/usr/local` tree
in all IOC stages, so that locally installed binaries, libraries and
configuration files can be used at runtime.

This allows us to build patched versions of tools (e.g. procServ) during
build phases and install them at IOC images, centralizing and making it
easier to track how they are built.

In addition, IOCs can also install custom files which will be available
at runtime in a known location. Also, IOCs themselves can also be
installed in FHS-compliant paths [1] inside the container as any other
packaged software, allowing them the use of conventional system software
in a straightforward manner (such as `env` executable discovery).

[1] https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s09.html
@ericonr
Copy link
Member

ericonr commented Feb 10, 2026

Do we need this for ADPimega at the moment?

@henriquesimoes
Copy link
Collaborator Author

Do we need this for ADPimega at the moment?

Nope. We're installing the required libraries at build and runtime. We wouldn't need to install libpimega at runtime if we had this PR merged.

cnpem/ad-aravis-epics-ioc#1 is depending on this to allow us to copy symlinks installed by the IOC under /usr/local/bin. If we make this something handled by epics-in-docker itself, it wouldn't need it. (Probably such internal implementation would, though.)

@ericonr
Copy link
Member

ericonr commented Feb 12, 2026

If we make this something handled by epics-in-docker itself, it wouldn't need it. (Probably such internal implementation would, though.)

Are you suggesting the IOC build script copy executables itself?

@henriquesimoes
Copy link
Collaborator Author

Are you suggesting the IOC build script copy executables itself?

Not necessarily. I was referring to the creation of a symbolic link at, say, /usr/local/bin/ioc pointing to /opt/$REPONAME/bin/linux-x86_64/<ioc-binary>. It could be a hard copy as well, though. In either case, we'll rely on this PR to copy the link or the binary itself from the build image to the final one in order to make this step actually meaningful.

@ericonr
Copy link
Member

ericonr commented Mar 17, 2026

It could be a hard copy as well, though. In either case, we'll rely on this PR to copy the link or the binary itself from the build image to the final one in order to make this step actually meaningful.

I think it would be possible to support defining only the link or hard copy without requiring a copy of everything under /usr/local. If it makes sense to do that instead of simplifying the recipe, I don't know. Especially considering the additional usefulness of this allowing RUNTIME_TAR_PACKAGES to be basically unused in favor of BUILD_TAR_PACKAGES.

@henriquesimoes
Copy link
Collaborator Author

Are you thinking about an explicit rule copying only the link (or binary) in a hard-coded way or a variable-based one?

If it is the latter, it would also work to get rid of the RUNTIME_TAR_PACKAGES. It would be more verbose to name everything to be copied explicitly, of course. But that's somewhat related to your comment in the other thread: #133 (comment).

However, it also assumes we know what's relevant beforehand, and we can always properly name them. I think that should be true given the build artifacts are deterministic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants