-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (34 loc) · 1.28 KB
/
Copy pathDockerfile
File metadata and controls
50 lines (34 loc) · 1.28 KB
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
40
41
42
43
44
45
46
47
48
49
50
FROM ghcr.io/astral-sh/uv:python3.14-alpine AS builder
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
WORKDIR /app
# Copy dependency files first to leverage Docker layer caching
COPY uv.lock pyproject.toml /app/
# Install dependencies without installing the project itself
RUN uv sync --frozen --no-install-project --no-dev
# Copy the rest of the application code
COPY . /app
# Sync the project
RUN uv sync --frozen --no-dev
# Use an ultra-small Python 3.14 Alpine runner image
FROM python:3.14-alpine
# Create a system user and group
RUN addgroup -g 10001 -S appgroup && \
adduser -u 10001 -S appuser -G appgroup
WORKDIR /app
# Copy files with correct ownership
COPY --from=builder --chown=appuser:appgroup /app /app
# Ensure data directory exists and is owned by the appuser
RUN mkdir -p /app/.data && chown -R appuser:appgroup /app/.data
# Make sure entrypoint script is executable
RUN chmod +x /app/entrypoint.sh
ENV PATH="/app/.venv/bin:$PATH"
# Expose the API port
EXPOSE 8889
# Create data directory volume
VOLUME [ "/app/.data" ]
# Switch to the non-root user
USER appuser
# Define the entrypoint
ENTRYPOINT ["/app/entrypoint.sh"]
# Run the supervisor so Experience/plugin switches replace the Python child.
CMD ["python", "-m", "src.supervisor", "--host", "0.0.0.0", "--port", "8889"]