-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
To use ENV variable in EntryPoint #1650
Comments
This is not a distroless specific issue. You cannot use ARG or ENV interpolation in My advice is to take approach 3, rarely should it matter that the binary name is dynamic for a minimal image since you're probably publishing the image with that same name ( |
Thanks for the reply. |
I don't build dotnet images, but if you only have one app per image you build it's a non-issue. Just publish image with whatever name you like, inside the container can be generic name.
I only have experience with Node, Rust, Go apps where it's a non-issue to use generic name. |
This is probably the more appropriate way to use containers anyway. Limit them to their single purpose. |
Yes that's often preferred, but sometimes you have multiple processes or services.
I've other projects myself where two services need to run but share access such as to the same files or connecting via sockets/ports. You can again split those out to separate images, but it's not always ideal.
That said when it can be helped, I definitely prefer the isolation. If service management needs to be added like with supervisord (which then requires Python), it adds additional complexity (including log management). |
Hello All,
I have 2 different applications (web apps) and 1 common Dockerfile through which i am building the apps and containerize it.
So far i was using full fledged images (debian); where in i was passing the exe name into the entrypoint as environment variable.
Now i was playing with distroless and its great. It offers lot size reduction. So i was doing the same and hit a road block.
I am unable to pass the environment variable to the entry point vector as shown:
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
SHELL ["/bin/bash", "-c"]
ARG csprojFileName
COPY . /home/src
RUN dotnet publish "$csprojFileName.csproj"
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-noble-chiseled
ARG csprojFileName
ENV CSPROJFILENAME $csprojFileName
EXPOSE 8080
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["./$CSPROJFILENAME"]
i tried changing ENTRYPOINT as ENTRYPOINT ["./${CSPROJFILENAME}"]; but no luck.
Please help; what could be the alternative approach if above is not supported?
Thanks
The text was updated successfully, but these errors were encountered: