keshan commited on
Commit
7758664
·
verified ·
1 Parent(s): 3ee0b9d

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -0
Dockerfile ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile for mcp_hackathon Gradio application
2
+
3
+ # 1. Base Image
4
+ FROM python:3.12-slim
5
+
6
+ # 2. Set Environment Variables
7
+ # PYTHONDONTWRITEBYTECODE: Prevents Python from writing .pyc files to disc (equivalent to python -B)
8
+ # PYTHONUNBUFFERED: Prevents Python from buffering stdin/stdout/stderr (equivalent to python -u)
9
+ ENV PYTHONDONTWRITEBYTECODE 1
10
+ ENV PYTHONUNBUFFERED 1
11
+
12
+ # 3. Install system dependencies (git) and uv (Python package manager)
13
+ RUN apt-get update && \
14
+ apt-get install -y --no-install-recommends git && \
15
+ pip install --no-cache-dir uv && \
16
+ apt-get clean && \
17
+ rm -rf /var/lib/apt/lists/*
18
+
19
+ # 4. Set working directory
20
+ WORKDIR /app
21
+
22
+ # 5. Clone the repository
23
+ # Cloning into the current directory (/app)
24
+ RUN git clone https://github.com/keshan/mcp_hackathon.git .
25
+
26
+ # 6. Install Python dependencies using uv
27
+ # uv sync will read pyproject.toml and install dependencies.
28
+ # It will create and use a virtual environment in .venv by default.
29
+ RUN uv sync
30
+
31
+ # 7. Expose the port Gradio runs on (default is 7860)
32
+ EXPOSE 7860
33
+
34
+ # 8. Command to run the application
35
+ # 'uv run' will execute the command within the context of the virtual environment.
36
+ # --host 0.0.0.0 makes the app accessible from outside the container.
37
+ # --port 7860 explicitly sets the Gradio port.
38
+ CMD ["uv", "run", "src/ui/app.py", "--host", "0.0.0.0", "--port", "7860"]