seatyyy commited on
Commit
8c7f5b4
·
verified ·
1 Parent(s): 29e1f4e

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. Dockerfile +87 -0
  2. README.md +1 -0
Dockerfile ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ghcr.io/meta-pytorch/openenv-base:latest AS builder
14
+
15
+ WORKDIR /app
16
+
17
+ # Ensure git is available (required for installing dependencies from VCS)
18
+ RUN apt-get update && \
19
+ apt-get install -y --no-install-recommends git && \
20
+ rm -rf /var/lib/apt/lists/*
21
+
22
+ # Build argument to control whether we're building standalone or in-repo
23
+ ARG BUILD_MODE=in-repo
24
+ ARG ENV_NAME=skill_forge
25
+
26
+ # Copy environment code (always at root of build context)
27
+ COPY . /app/env
28
+
29
+ # For in-repo builds, openenv is already vendored in the build context
30
+ # For standalone builds, openenv will be installed via pyproject.toml
31
+ WORKDIR /app/env
32
+
33
+ # Ensure uv is available (for local builds where base image lacks it)
34
+ RUN if ! command -v uv >/dev/null 2>&1; then \
35
+ curl -LsSf https://astral.sh/uv/install.sh | sh && \
36
+ mv /root/.local/bin/uv /usr/local/bin/uv && \
37
+ mv /root/.local/bin/uvx /usr/local/bin/uvx; \
38
+ fi
39
+
40
+ # Install dependencies using uv sync
41
+ # If uv.lock exists, use it; otherwise resolve on the fly
42
+ RUN --mount=type=cache,target=/root/.cache/uv \
43
+ if [ -f uv.lock ]; then \
44
+ uv sync --frozen --no-install-project --no-editable; \
45
+ else \
46
+ uv sync --no-install-project --no-editable; \
47
+ fi
48
+
49
+ RUN --mount=type=cache,target=/root/.cache/uv \
50
+ if [ -f uv.lock ]; then \
51
+ uv sync --frozen --no-editable; \
52
+ else \
53
+ uv sync --no-editable; \
54
+ fi
55
+
56
+ # Final runtime stage
57
+ FROM ghcr.io/meta-pytorch/openenv-base:latest
58
+
59
+ WORKDIR /app
60
+
61
+ # Install git (required by HF Spaces runtime)
62
+ RUN apt-get update && \
63
+ apt-get install -y --no-install-recommends git && \
64
+ rm -rf /var/lib/apt/lists/*
65
+
66
+ # Copy the virtual environment from builder
67
+ COPY --from=builder /app/env/.venv /app/.venv
68
+
69
+ # Copy the environment code
70
+ COPY --from=builder /app/env /app/env
71
+
72
+ # Set PATH to use the virtual environment
73
+ ENV PATH="/app/.venv/bin:$PATH"
74
+
75
+ # Set PYTHONPATH so imports work correctly
76
+ ENV PYTHONPATH="/app/env:$PYTHONPATH"
77
+
78
+ # Enable the OpenEnv web interface
79
+ ENV ENABLE_WEB_INTERFACE="true"
80
+
81
+ # Health check
82
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
83
+ CMD curl -f http://localhost:8000/health || exit 1
84
+
85
+ # Run the FastAPI server
86
+ # The module path is constructed to work with the /app/env structure
87
+ CMD ["sh", "-c", "cd /app/env && uvicorn server.app:app --host 0.0.0.0 --port 8000"]
README.md CHANGED
@@ -3,6 +3,7 @@ title: SkillForge
3
  emoji: 🔨
4
  sdk: docker
5
  pinned: false
 
6
  ---
7
  **SkillForge** — An RL training environment where LLM Agents evolve from "reinventing the wheel" to "building a tool library."
8
 
 
3
  emoji: 🔨
4
  sdk: docker
5
  pinned: false
6
+ base_path: /web
7
  ---
8
  **SkillForge** — An RL training environment where LLM Agents evolve from "reinventing the wheel" to "building a tool library."
9