Skip to content

Update Dockerfile#273

Closed
cudeso wants to merge 1 commit intoMISP:masterfrom
cudeso:patch-1
Closed

Update Dockerfile#273
cudeso wants to merge 1 commit intoMISP:masterfrom
cudeso:patch-1

Conversation

@cudeso
Copy link
Contributor

@cudeso cudeso commented Jul 15, 2025

Fixes #265

Solves variable expansion differences between Podman and Docker.

@ostefano
Copy link
Collaborator

I will need to investigate this more.

How do you run podman to build the images?
I would like to add more build tests

@ostefano
Copy link
Collaborator

@cudeso have you tried using the SHELL variable for the whole build process (https://docs.docker.com/reference/dockerfile/#shell) ?

@ostefano ostefano added the help wanted Extra attention is needed label Jul 20, 2025
@cudeso
Copy link
Contributor Author

cudeso commented Jul 21, 2025

@ostefano
Yes.
When using SHELL ["/usr/bin/sh", "-c"] or SHELL ["/usr/bin/bash", "-c"] as the first line in core/Dockerfile the build completes fine, but the original error message with /usr/local/bin/supervisord re-occurs.

I've done each build with the same command, which basically resets the system to its original state.

podman system prune ; podman image rm ghcr.io/misp/misp-docker/misp-core ; rm -f build.log ; cp template.env .env ; PODMAN_COMPOSE_VERBOSE=1 podman compose build --no-cache | tee build.log

@ostefano
Copy link
Collaborator

That is weird though right? We would expect setting bash globally for the build to fix this. Since it's a multi step build, have you tried adding it just to the offending step?

@ostefano ostefano added the question Further information is requested label Jul 24, 2025
@cudeso
Copy link
Contributor Author

cudeso commented Jul 24, 2025

That is weird though right? We would expect setting bash globally for the build to fix this. Since it's a multi step build, have you tried adding it just to the offending step?

Indeed. Don't fully understand why the global setting doesn't fix it.
I added it on the offending step with RUN bash <<'EOF' (the PR); I have not tried it with adding the SHELL command prior to that step, as from the documentation the SHELL command applies to everything that follows next in the Dockerfile, except if you override it with another shell.

Copy link
Collaborator

@ostefano ostefano left a comment

Choose a reason for hiding this comment

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

See comment.

EOF

RUN <<-EOF
RUN bash <<'EOF'
Copy link
Collaborator

Choose a reason for hiding this comment

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

@cudeso are quotes necessary here? My understanding is that they are not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I initially also considered them optional, but removing them results in build error

4/5] STEP 19/19: RUN bash <<-EOF
bash: line 18: [: : integer expression expected
Skipping overwriting  due to missing version variable
--> 518f13e9d985
--> 76e4f9f0a3dd
[5/5] STEP 11/23: RUN pip install --no-cache-dir /wheels/*.whl && rm -rf /wheels
WARNING: Requirement '/wheels/*.whl' looks like a filename, but the file does not exist

[notice] A new release of pip is available: 25.0.1 -> 25.1.1
[notice] To update, run: pip install --upgrade pip
ERROR: *.whl is not a valid wheel filename.
Error: building at STEP "RUN pip install --no-cache-dir /wheels/*.whl && rm -rf /wheels": while running runtime: exit status 1
Error: executing /usr/local/bin/podman-compose build --no-cache: exit status 1

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is getting so random...

Do we know what was the shell expansion that did not work without this workaround?
Asking because we might need to retrofit this workaround to other build steps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, basically the expansion did not work in the for loop (line 180 and further).
Printing out the variables PYPI_MODULE_NAME_VERSION before and after the the "for mod in" loop indicated they were set. But within the for loop they were empty.
In that for loop, it affected all PYPI_ variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is indeed very weird/random. Using bash, with escaping the EOF was eventually the only way I found working to get those variables retain their value.

Copy link
Collaborator

@ostefano ostefano Jul 28, 2025

Choose a reason for hiding this comment

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

Not happy yet, trying to reproduce things locally. How are you building it? Are you using podman-compose?

Because if I do so via COMPOSE_PROGRESS=plain podman compose build misp-core, I get this:

Skipping overwriting redis due to missing version variable
Skipping overwriting lief due to missing version variable
Skipping overwriting pydeep2 due to missing version variable
Skipping overwriting python-magic due to missing version variable
Skipping overwriting misp-lib-stix2 due to missing version variable
Skipping overwriting maec due to missing version variable
Skipping overwriting mixbox due to missing version variable
Skipping overwriting cybox due to missing version variable
Skipping overwriting pymisp due to missing version variable
Skipping overwriting misp-stix due to missing version variable
Adding missing module setuptools with version '==80.3.1'
Adding missing module supervisor with version '==4.2.5'

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same with podman-compose (skipping the compose provider selection)

@ostefano
Copy link
Collaborator

As per chat, this will be converted into a doc update where we suggest the workaround to users relying on an old (pre 5) version of podman

@ostefano ostefano added documentation Improvements or additions to documentation and removed help wanted Extra attention is needed question Further information is requested labels Jul 28, 2025
@cudeso
Copy link
Contributor Author

cudeso commented Jul 29, 2025

As per chat, this will be converted into a doc update where we suggest the workaround to users relying on an old (pre 5) version of podman

Added #285

@ostefano ostefano closed this Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/usr/local/bin/supervisord: No such file or directory

2 participants