Download server/tasks/task_2_docker_runtime.py from jester1177/cloudnative-devops-debug-env: direct link, hf CLI and curl.
- Browser
- Download file 1.65 kB
-
https://huggingface.co/spaces/jester1177/cloudnative-devops-debug-env/resolve/23e4aa85a7a9498354a90ebadceaeb9cae58995c/server/tasks/task_2_docker_runtime.py
- Command line
-
hf download hf://spaces/jester1177/cloudnative-devops-debug-env@23e4aa85a7a9498354a90ebadceaeb9cae58995c/server/tasks/task_2_docker_runtime.py
-
curl -L -o task_2_docker_runtime.py https://huggingface.co/spaces/jester1177/cloudnative-devops-debug-env/resolve/23e4aa85a7a9498354a90ebadceaeb9cae58995c/server/tasks/task_2_docker_runtime.py
1.65 kB
| from __future__ import annotations | |
| import random | |
| from typing import Dict, Optional | |
| from server.models import TaskDifficulty | |
| from server.tasks.base import BaseTask | |
| class DockerfileRuntimeTask(BaseTask): | |
| NAME = "Dockerfile Runtime Errors" | |
| DESCRIPTION = "Fix runtime/container execution issues in Dockerfiles" | |
| DIFFICULTY = TaskDifficulty.MEDIUM | |
| AVAILABLE_SECRETS = [] | |
| SCENARIOS = [ | |
| { | |
| "id": "missing_workdir", | |
| "files": [ | |
| { | |
| "path": "Dockerfile", | |
| "type": "dockerfile", | |
| "content": "FROM node:18-alpine\nCOPY package*.json ./\nRUN npm ci\nCOPY . .\nCMD [\"npm\", \"start\"]", | |
| }, | |
| {"path": "package.json", "type": "other", "content": '{"name": "app", "scripts": {"start": "node index.js"}}'}, | |
| ], | |
| "error": { | |
| "phase": "docker_run", | |
| "message": "Error: Cannot find module '/package.json'", | |
| }, | |
| "expected_fixes": [ | |
| { | |
| "file": "Dockerfile", | |
| "type": "contains", | |
| "expected": "WORKDIR /app", | |
| "hint": "Set a working directory before COPY/RUN", | |
| } | |
| ], | |
| } | |
| ] | |
| def load_scenario(self, scenario_id: Optional[str] = None) -> Dict: | |
| if scenario_id: | |
| for scenario in self.SCENARIOS: | |
| if scenario["id"] == scenario_id: | |
| return scenario | |
| raise ValueError(f"Unknown scenario: {scenario_id}") | |
| return random.choice(self.SCENARIOS) | |