Viraaj Sawant commited on
Commit
1bf77f2
·
1 Parent(s): 9536234

Restore original folder structure: use server/Dockerfile

Browse files
rl_code_fix_env/Dockerfile DELETED
@@ -1,74 +0,0 @@
1
-
2
- ARG BASE_IMAGE=ghcr.io/meta-pytorch/openenv-base:latest
3
- FROM ${BASE_IMAGE} AS builder
4
-
5
- WORKDIR /app
6
-
7
- # Ensure git is available (required for installing dependencies from VCS)
8
- RUN apt-get update && \
9
- apt-get install -y --no-install-recommends git && \
10
- rm -rf /var/lib/apt/lists/*
11
-
12
- # Build argument to control whether we're building standalone or in-repo
13
- ARG BUILD_MODE=in-repo
14
- ARG ENV_NAME=rl_code_fix_env
15
-
16
- # Copy environment code (always at root of build context)
17
- COPY . /app/env
18
-
19
- # For in-repo builds, openenv is already vendored in the build context
20
- # For standalone builds, openenv will be installed via pyproject.toml
21
- WORKDIR /app/env
22
-
23
- # Ensure uv is available (for local builds where base image lacks it)
24
- RUN if ! command -v uv >/dev/null 2>&1; then \
25
- curl -LsSf https://astral.sh/uv/install.sh | sh && \
26
- mv /root/.local/bin/uv /usr/local/bin/uv && \
27
- mv /root/.local/bin/uvx /usr/local/bin/uvx; \
28
- fi
29
-
30
- # Install dependencies using uv sync
31
- # If uv.lock exists, use it; otherwise resolve on the fly
32
- RUN --mount=type=cache,target=/root/.cache/uv \
33
- if [ -f uv.lock ]; then \
34
- uv sync --frozen --no-install-project --no-editable; \
35
- else \
36
- uv sync --no-install-project --no-editable; \
37
- fi
38
-
39
- RUN --mount=type=cache,target=/root/.cache/uv \
40
- if [ -f uv.lock ]; then \
41
- uv sync --frozen --no-editable; \
42
- else \
43
- uv sync --no-editable; \
44
- fi
45
-
46
- # Final runtime stage
47
- FROM ${BASE_IMAGE}
48
-
49
- WORKDIR /app
50
-
51
- # Copy environment code + its in-place virtualenv from builder.
52
- # Keep the venv at the same path it was created with (/app/env/.venv)
53
- # to avoid relocation issues and dual-venv path conflicts.
54
- COPY --from=builder /app/env /app/env
55
-
56
- # Use the single in-repo venv
57
- ENV VIRTUAL_ENV="/app/env/.venv"
58
- ENV PATH="/app/env/.venv/bin:$PATH"
59
-
60
- # Hermetic runtime: keep imports pinned to repo code + active venv.
61
- ENV PYTHONPATH="/app/env"
62
- ENV PYTHONNOUSERSITE="1"
63
- ENV PYTHONDONTWRITEBYTECODE="1"
64
-
65
- # Health check
66
- HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
67
- CMD curl -f http://localhost:8000/health || exit 1
68
-
69
- # Expose the application port
70
- EXPOSE 8000
71
-
72
- # Run the FastAPI server
73
- # The module path is constructed to work with the /app/env structure
74
- CMD ["sh", "-c", "cd /app/env && uvicorn server.app:app --host 0.0.0.0 --port 8000"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rl_code_fix_env/README.md CHANGED
@@ -4,6 +4,7 @@ emoji: 🚀
4
  colorFrom: green
5
  colorTo: purple
6
  sdk: docker
 
7
  app_port: 8000
8
  pinned: false
9
  ---
 
4
  colorFrom: green
5
  colorTo: purple
6
  sdk: docker
7
+ dockerfile: server/Dockerfile
8
  app_port: 8000
9
  pinned: false
10
  ---