diff --git a/Dockerfile b/Dockerfile index e372ce6..72c1f8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,5 +16,9 @@ RUN pip install --no-cache-dir -r requirements.txt # Set the working directory to /app WORKDIR /app -# Set this as the default command -# ENTRYPOINT [ "python", "/app_src/main.py" ] \ No newline at end of file +# Copy and set the entrypoint script +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +# Set the entrypoint script as the default command +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..6cc5604 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +echo "Starting entrypoint script..." + +if [ "$1" = "python3" ] || [ "$1" = "python" ]; then + # If the first argument is python or python3, execute the user-specified command + echo "Executing user-specified python command: $@" + exec "$@" +else + # Otherwise, execute the default python3 /app_src/main.py command with all arguments + echo "Executing default command: python3 /app_src/main.py $@" + exec python3 /app_src/main.py "$@" +fi \ No newline at end of file