Aasher commited on
Commit
7615881
·
1 Parent(s): e6f8b05

Add docker file for deployment

Browse files
Files changed (3) hide show
  1. .dockerignore +29 -0
  2. .github/README.md +0 -0
  3. Dockerfile +40 -0
.dockerignore ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Git
2
+ .git/
3
+ .gitignore
4
+
5
+ # Docker
6
+ Dockerfile
7
+
8
+ # Python virtual environments
9
+ venv/
10
+ env/
11
+ .venv/
12
+
13
+ # Python cache
14
+ __pycache__/
15
+ *.pyc
16
+ *.pyo
17
+ *.pyd
18
+
19
+ # IDE and OS files
20
+ .vscode/
21
+ .idea/
22
+ .DS_Store
23
+
24
+ # Local environment variables
25
+ .env
26
+
27
+ # Testing
28
+ .pytest_cache/
29
+ htmlcov/
.github/README.md ADDED
File without changes
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Base image
2
+ FROM python:3.12-slim
3
+
4
+ # Install system dependencies and uv as root
5
+ RUN apt-get update && \
6
+ apt-get install -y curl && \
7
+ curl -LsSf https://astral.sh/uv/install.sh | sh && \
8
+ mv /root/.local/bin/uv /usr/local/bin/ && \
9
+ mv /root/.local/bin/uvx /usr/local/bin/ && \
10
+ mkdir -p /.cache/uv
11
+
12
+ # Copy project configuration first
13
+ COPY pyproject.toml .
14
+
15
+ # Install Python packages as root using uv sync
16
+ RUN uv sync && \
17
+ rm -rf /.uv
18
+
19
+ # Create and switch to non-root user
20
+ RUN useradd -m -u 1000 user && \
21
+ chown -R user:user /.cache/uv
22
+
23
+ USER user
24
+
25
+ # Set up environment
26
+ ENV HOME=/home/user \
27
+ PATH=/home/user/.local/bin:/usr/local/bin:$PATH \
28
+ PORT=7860 \
29
+ PYTHONUNBUFFERED=1
30
+
31
+ WORKDIR $HOME/app
32
+
33
+ # Copy application files with correct ownership
34
+ COPY --chown=user:user . .
35
+
36
+ # Expose the port the app runs on
37
+ EXPOSE 7860
38
+
39
+ # Command to run the application using Uvicorn
40
+ CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]