Use uv
Some checks failed
ci/woodpecker/pr/docker-buildx Pipeline failed
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful

This commit is contained in:
Liam Steckler 2025-01-11 11:58:05 -08:00
parent d9c589e9c5
commit adb34c8869

View file

@ -1,23 +1,21 @@
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3
FROM python:3 AS build
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Install pip requirements
COPY requirements.txt .
RUN python -m pip install -r requirements.txt
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /app
COPY . /app
RUN uv venv
COPY requirements.txt .
RUN uv pip install --system -r requirements.txt
# Copy the project into the intermediate image
ADD . /app
FROM python:3-slim
# Copy the environment, but not the source code
COPY --from=build --chown=app:app /app/.venv /app/.venv
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["python", "scl.py"]