diff --git a/.dockerignore b/.dockerignore index 98a9d48c77..4c3fa2310c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,6 @@ .dockerignore Dockerfile +.git # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/Dockerfile b/Dockerfile index 06cd587661..295de7777a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,28 @@ -FROM --platform=linux/amd64 python:3.11 +FROM --platform=linux/amd64 python:3.11@sha256:5062f6c22a2c3b8b3717c642af3852310d9a81c3c2c0fc72449a9a79ef09ae63 + +# Install uv +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ + +ENV UV_COMPILE_BYTECODE=1 +ENV PYTHONUNBUFFERED=1 ################### ## Parsons setup ## ################### -RUN mkdir /src -COPY . /src/ WORKDIR /src +COPY pyproject.toml setup.py ./ +RUN uv sync --no-editable --all-extras --no-dev --python python3.11 -# Install uv -COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ +COPY . /src/ -# Install parsons -RUN uv sync --upgrade --all-extras --python python3.11 ENV PATH="/src/.venv/bin:$PATH" +ENV PYTHONPATH=.:/app # The /app directory can house the scripts that will actually execute on this Docker image. -# Eg. If using this image in a Civis container script, Civis will install your script repo -# (from Github) to /app. +# Eg. If using this image in a Civis container script, +# Civis will install your script repo (from Github) to /app. RUN mkdir /app WORKDIR /app -# Useful for importing modules that are associated with your python scripts: -ENV PYTHONPATH=.:/app +CMD ["python3"]