# Use an official Python image as a base FROM python:3.11.11-slim-bullseye # Set the working directory to /app WORKDIR /app # Install the dependencies RUN apt-get update && apt-get install -y libgl1 RUN apt-get update && apt-get install -y libglib2.0-dev RUN apt-get update && apt-get install -y libzbar0 RUN apt-get update && apt-get install -y cmake build-essential xmlsec1 libxmlsec1-dev RUN apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl COPY requirements_dev.txt . RUN pip install --upgrade pip RUN pip install -r requirements_dev.txt # Create a new user and group RUN groupadd -r appgroup RUN useradd -r -g appgroup -G appgroup -m -d /app -s /bin/false appuser # Copy the requirements file # Copy the application code COPY . . # Expose the port EXPOSE 8000 # Make the script executable RUN chmod +x *.sh # Change ownership of the app directory to the new user RUN chown -R appuser:appgroup /app # Set the entrypoint to execute the script as the new user ENTRYPOINT ["sh", "-c", "python3 manage.py runserver 0.0.0.0:8000"]