Skip to content

Commit cec6bd2

Browse files
authored
Update Dockerfile
Handle container entrypoint for interactive and non-interactive usage. If no arguments are passed to the container, it starts a bash shell. If arguments are passed, it executes them as a command. Tested on Windows and Fedora Linux.
1 parent 7706b03 commit cec6bd2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

docker/Dockerfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,13 @@ RUN rm -rf /build
108108
# Set the working directory
109109
WORKDIR /workspace
110110

111-
# Set the entrypoint
112-
ENTRYPOINT ["/bin/bash"]
111+
# Handle entrypoint for interactive and non-interactive
112+
RUN echo '#!/bin/bash\n\
113+
if [ $# -eq 0 ]; then\n\
114+
exec /bin/bash\n\
115+
else\n\
116+
exec "$@"\n\
117+
fi' > /entrypoint.sh && chmod +x /entrypoint.sh
118+
119+
# Set the entrypoint to script
120+
ENTRYPOINT ["/entrypoint.sh"]

0 commit comments

Comments
 (0)