arya89 commited on
Commit
c4b37a1
·
verified ·
1 Parent(s): fadb6a6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -71
Dockerfile CHANGED
@@ -1,71 +1,30 @@
1
- # Copyright (c) Meta Platforms, Inc. and affiliates.
2
- # All rights reserved.
3
- #
4
- # This source code is licensed under the BSD-style license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- # Multi-stage build using openenv-base
8
- # This Dockerfile is flexible and works for both:
9
- # - In-repo environments (with local OpenEnv sources)
10
- # - Standalone environments (with openenv from PyPI/Git)
11
- # The build script (openenv build) handles context detection and sets appropriate build args.
12
-
13
- # Use OpenEnv base image
14
- FROM ghcr.io/meta-pytorch/openenv-base:latest AS builder
15
-
16
- WORKDIR /app
17
-
18
- # Install system dependencies
19
- RUN apt-get update && \
20
- apt-get install -y --no-install-recommends \
21
- curl \
22
- ca-certificates && \
23
- rm -rf /var/lib/apt/lists/*
24
-
25
- # Copy entire environment
26
- COPY . /app/env
27
-
28
- WORKDIR /app/env
29
-
30
- # Install uv if not present
31
- RUN if ! command -v uv >/dev/null 2>&1; then \
32
- curl -LsSf https://astral.sh/uv/install.sh | sh; \
33
- fi
34
-
35
- ENV PATH="/root/.cargo/bin:$PATH"
36
-
37
- # Sync dependencies
38
- RUN --mount=type=cache,target=/root/.cache/uv \
39
- if [ -f uv.lock ]; then \
40
- uv sync --frozen --no-dev; \
41
- else \
42
- uv sync --no-dev; \
43
- fi
44
-
45
- # Install openenv-core
46
- RUN --mount=type=cache,target=/root/.cache/uv \
47
- if [ -f uv.lock ]; then \
48
- uv pip install openenv-core --python .venv/bin/python; \
49
- else \
50
- uv pip install openenv-core --python .venv/bin/python; \
51
- fi
52
-
53
- # Runtime stage
54
- FROM ghcr.io/meta-pytorch/openenv-base:latest
55
-
56
- WORKDIR /app
57
-
58
- # Copy virtual environment and app
59
- COPY --from=builder /app/env/.venv /app/.venv
60
- COPY --from=builder /app/env /app/env
61
-
62
- ENV PATH="/app/.venv/bin:$PATH"
63
- ENV PYTHONPATH="/app/env:$PYTHONPATH"
64
-
65
- WORKDIR /app/env
66
-
67
- # Expose port
68
- EXPOSE 7860
69
-
70
- # Start the server
71
- CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ # All rights reserved.
3
+ #
4
+ # This source code is licensed under the BSD-style license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ # Multi-stage build using openenv-base
8
+ # This Dockerfile is flexible and works for both:
9
+ # - In-repo environments (with local OpenEnv sources)
10
+ # - Standalone environments (with openenv from PyPI/Git)
11
+ # The build script (openenv build) handles context detection and sets appropriate build args.
12
+
13
+ FROM python:3.11-slim
14
+
15
+ WORKDIR /app
16
+
17
+ COPY . /app
18
+
19
+ RUN pip install --no-cache-dir \
20
+ openenv-core \
21
+ fastapi \
22
+ uvicorn[standard] \
23
+ pydantic \
24
+ openai
25
+
26
+ ENV PYTHONPATH="/app:"
27
+
28
+ EXPOSE 7860
29
+
30
+ CMD ["python", "-m", "uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]