Use uv
This commit is contained in:
parent
d9c589e9c5
commit
adb34c8869
1 changed files with 14 additions and 16 deletions
30
Dockerfile
30
Dockerfile
|
@ -1,23 +1,21 @@
|
||||||
# For more information, please refer to https://aka.ms/vscode-docker-python
|
FROM python:3 AS build
|
||||||
FROM python:3
|
|
||||||
|
|
||||||
# Keeps Python from generating .pyc files in the container
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
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
|
|
||||||
|
|
||||||
WORKDIR /app
|
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
|
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
|
||||||
USER appuser
|
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"]
|
||||||
CMD ["python", "scl.py"]
|
|
Loading…
Add table
Reference in a new issue