Files
Botator/Dockerfile

30 lines
769 B
Docker
Raw Normal View History

FROM python:3.11-bookworm
2023-11-02 17:09:43 +01:00
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
2022-11-27 16:02:54 +01:00
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
2023-11-02 17:09:43 +01:00
# we move to the app folder and run the pip install command
WORKDIR /app
# we copy just the requirements.txt first to leverage Docker cache
2022-11-27 16:02:54 +01:00
COPY requirements.txt .
2023-11-02 17:09:43 +01:00
2024-01-08 10:26:36 +01:00
# Install pip requirements + git
RUN apt update && apt install git
2022-11-27 16:02:54 +01:00
RUN pip install -r requirements.txt
2023-11-02 17:09:43 +01:00
2022-11-27 16:02:54 +01:00
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
2023-11-02 17:09:43 +01:00
RUN adduser -u 5574 --disabled-password --gecos "" appuser && chown -R appuser /app
2022-11-27 16:02:54 +01:00
USER appuser
2023-11-02 17:09:43 +01:00
# We copy the rest of the codebase into the image
COPY . /app
# We run the application
CMD ["python", "main.py"]