| 1234567891011121314151617181920212223242526272829303132333435 | # Use a Python base image (slim version to keep it small)FROM python:3.9-slim-buster# Install gitRUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*# Set the working directory inside the containerWORKDIR /app# Set the home directory environment variableENV HOME=/home/appuser# Create a non-root user and groupRUN groupadd -r appgroup && useradd --no-log-init -r -g appgroup -d /home/appuser -m appuser# Install any necessary dependencies (in this case, just the google-generativeai library)RUN pip install --no-cache-dir google-generativeai# Copy the Python script into the containerCOPY git_rebase_ai.py /app/# Make the script executableRUN chmod +x /app/git_rebase_ai.pyWORKDIR /repo# Change ownership of the app and repo directoriesRUN chown -R appuser:appgroup /app && chown -R appuser:appgroup /repo# Switch to the non-root userUSER appuser# Set the entrypoint to run the script when the container startsENTRYPOINT ["python", "/app/git_rebase_ai.py"]
 |