June 11, 20251 yr I am trying to host a discord bot that I am putting together which I have hosted on a private github repo being pushed to docker hub to install as a container on my unraid server.Issue is, it for some reason isn't updating the installed dependencies when I add a new one to my requirements.txtI am a huge novice when it comes to docker and was hoping someone can shed some light on what im doing wrong?Here is my dockerfile omitting private info# Use an official Python runtime as a parent imageFROM python:3.10-slim# Install git and upgrade pipRUN apt-get update && \apt-get install -y git && \pip install --upgrade pip && \rm -rf /var/lib/apt/lists/*# Set the working directoryWORKDIR /app# Copy the entrypoint script into the containerCOPY docker-entrypoint.sh /app/docker-entrypoint.sh# Make the entrypoint script executableRUN chmod +x /app/docker-entrypoint.sh# Set the entrypointENTRYPOINT ["/app/docker-entrypoint.sh"]# Default commandCMD []and here is my docker-entrypoint.sh fileset -eTARGET_BRANCH=${GIT_BRANCH:-main}APP_DIR="/app"GIT_SOURCE_DIR="/app_source_repo"if [ -z "$GITHUB_TOKEN" ]; then echo "Error: GITHUB_TOKEN not set."; exit 1; fiif [ -z "$GIT_REPO_URL" ]; then echo "Error: GIT_REPO_URL not set."; exit 1; fiecho "Ensuring git repository ($GIT_REPO_URL, branch $TARGET_BRANCH) is up to date in $GIT_SOURCE_DIR..."AUTH_GIT_REPO_URL=$(echo "$GIT_REPO_URL" | sed "s|https://|https://x-access-token:${GITHUB_TOKEN}@|")if [ -d "$GIT_SOURCE_DIR/.git" ]; thenecho "Existing repository found in $GIT_SOURCE_DIR. Attempting to update..."cd "$GIT_SOURCE_DIR"git config http.sslVerify truegit config pull.rebase falsecurrent_branch=$(git rev-parse --abbrev-ref HEAD)if [ "$current_branch" != "$TARGET_BRANCH" ]; thenecho "Current branch is $current_branch, switching to $TARGET_BRANCH..."git checkout "$TARGET_BRANCH" || git checkout -b "$TARGET_BRANCH" origin/"$TARGET_BRANCH"figit fetch origin "$TARGET_BRANCH"echo "Resetting to origin/$TARGET_BRANCH..."git reset --hard "origin/$TARGET_BRANCH"echo "Cleaning repository..."git clean -fdxcd "$APP_DIR"echo "Repository updated."elseecho "No existing repository found. Cloning fresh into $GIT_SOURCE_DIR..."rm -rf "$GIT_SOURCE_DIR"git clone --branch "$TARGET_BRANCH" --single-branch "$AUTH_GIT_REPO_URL" "$GIT_SOURCE_DIR"echo "Repository cloned."fiecho "Copying necessary files from $GIT_SOURCE_DIR to $APP_DIR..."mkdir -p "$APP_DIR/src"rm -rf "$APP_DIR/src"/* "$APP_DIR/requirements.txt"if [ -d "$GIT_SOURCE_DIR/src" ]; thencp -R "$GIT_SOURCE_DIR/src/." "$APP_DIR/src/"echo "Copied src/ directory."elseecho "Error: src/ directory not found in repository at $GIT_SOURCE_DIR/src."exit 1fiif [ -f "$GIT_SOURCE_DIR/requirements.txt" ]; thencp "$GIT_SOURCE_DIR/requirements.txt" "$APP_DIR/requirements.txt"echo "Copied requirements.txt."elseecho "Error: requirements.txt not found in repository at $GIT_SOURCE_DIR/requirements.txt."exit 1fiecho "Necessary files copied to $APP_DIR."echo "Installing/Updating Python dependencies from $APP_DIR/requirements.txt..."pip install --no-cache-dir -r "$APP_DIR/requirements.txt"cd "$APP_DIR/src"echo "Starting bot from $APP_DIR/src/bot.py..."exec python bot.py "$@"Any help would be much appreciated! docker-entrypoint.sh Dockerfile Edited June 11, 20251 yr by Abhi
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.