-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker
More file actions
41 lines (29 loc) · 1021 Bytes
/
Copy pathdocker
File metadata and controls
41 lines (29 loc) · 1021 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
40
41
### --- Build Stage --- ###
FROM ghcr.io/prefix-dev/pixi:latest AS build
WORKDIR /app
COPY pixi.toml pixi.lock ./
COPY . .
# Install locked dependencies and create env activation script
RUN pixi install --locked \
&& pixi shell-hook -s bash > /shell-hook.sh \
&& echo 'exec "$@"' >> /shell-hook.sh
### --- Runtime Stage --- ###
FROM python:3.11-slim
RUN apt-get update && apt-get install -y \
libglib2.0-0 libsm6 libxrender1 libxext6 curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy Pixi environment and activation script from build stage
COPY --from=build /app/.pixi /app/.pixi
COPY --from=build /shell-hook.sh /app/entrypoint.sh
# Copy app source code
COPY . .
RUN chmod +x /app/entrypoint.sh
# Ensure Pixi environment binaries are in PATH
ENV PATH="/app/.pixi/envs/default/bin:$PATH"
# Expose ports for FastAPI and Gradio
EXPOSE 8000 7860
# Entrypoint to activate Pixi environment, then run CMD
ENTRYPOINT ["/app/entrypoint.sh"]
# Run your app entrypoint
CMD ["python", "main.py"]