Dockerfile 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. # For more information, please refer to https://aka.ms/vscode-docker-python
  2. FROM python:3.10-slim
  3. EXPOSE 5002
  4. # Keeps Python from generating .pyc files in the container
  5. ENV PYTHONDONTWRITEBYTECODE=1
  6. # Turns off buffering for easier container logging
  7. ENV PYTHONUNBUFFERED=1
  8. # RUN mkdir -p ~/.pip
  9. # RUN echo '\n\
  10. # [global] \n\
  11. # trusted-host=mirrors.aliyun.com \n\
  12. # index-url=https://mirrors.aliyun.com/pypi/simple/ \n\
  13. # ' > ~/.pip/pip.conf
  14. # Install pip requirements
  15. COPY requirements.txt .
  16. RUN python -m pip install -r requirements.txt
  17. RUN python -m pip install pyinstaller
  18. WORKDIR /app
  19. COPY . /app
  20. # Creates a non-root user with an explicit UID and adds permission to access the /app folder
  21. # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
  22. RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
  23. USER appuser
  24. VOLUME [ "/app" ]
  25. # During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
  26. CMD ["pyinstaller", "-F", "-c", "main.py"]