-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (26 loc) · 981 Bytes
/
Dockerfile
File metadata and controls
39 lines (26 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Define the build argument with default value
ARG PYTHON_VERSION=3.12
FROM ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-bookworm-slim AS builder
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
ENV UV_PYTHON_DOWNLOADS=0
ENV UV_COMPILE_BYTECODE=1
ENV UV_CACHE_DIR=/app/.cache
WORKDIR /app
RUN apt update && apt install git -y
# Just in case for future external caching mechanisms
RUN --mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=.git,target=.git \
uv sync --frozen --no-install-project --no-dev --no-editable
COPY . /app
# Install project
RUN uv sync --frozen --no-dev --no-editable
FROM ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-bookworm-slim
# Create app user and group
RUN groupadd -r app && useradd -r -g app app
COPY --from=builder --chown=app:app /app /app
WORKDIR /app
ENV UV_CACHE_DIR=/app/.cache
ENV PATH="/app/.venv/bin:$PATH"
USER app
CMD ["spark-mcp"]