Initial Dockerfile #73
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
|
||||
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"]
|
||||
CMD ["python", "scl.py"]
|
Loading…
Add table
Reference in a new issue