Dockerfile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Use a Python base image (slim version to keep it small)
  2. FROM python:3.9-slim-buster
  3. # Install git
  4. RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
  5. # Set the working directory inside the container
  6. WORKDIR /app
  7. # Set the home directory environment variable
  8. ENV HOME=/home/appuser
  9. # Create a non-root user and group
  10. RUN groupadd -r appgroup && useradd --no-log-init -r -g appgroup -d /home/appuser -m appuser
  11. # Install any necessary dependencies (in this case, just the google-generativeai library)
  12. RUN pip install --no-cache-dir google-generativeai
  13. # Copy the Python script into the container
  14. COPY git_commit_ai.py /app/
  15. COPY git_rebase_ai.py /app/
  16. COPY git_reword_ai.py /app/
  17. # Make the script executable
  18. RUN chmod +x /app/git_commit_ai.py ; \
  19. chmod +x /app/git_rebase_ai.py
  20. WORKDIR /repo
  21. # Change ownership of the app and repo directories
  22. RUN chown -R appuser:appgroup /app && chown -R appuser:appgroup /repo
  23. # Switch to the non-root user
  24. USER appuser
  25. # Set the entrypoint to run the script when the container starts
  26. ENTRYPOINT ["python"]