codeby-hp commited on
Commit
29a9662
·
verified ·
1 Parent(s): ae467e7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -29
Dockerfile CHANGED
@@ -1,29 +1,29 @@
1
- FROM python:3.10-slim
2
-
3
- WORKDIR /app
4
-
5
- RUN apt-get update && apt-get install -y --no-install-recommends \
6
- build-essential \
7
- && rm -rf /var/lib/apt/lists/*
8
-
9
- COPY fastapi_app/requirements.txt .
10
- RUN pip install --no-cache-dir -r requirements.txt
11
-
12
- # Copy application code (excluding models directory)
13
- COPY fastapi_app/app.py .
14
- COPY fastapi_app/scripts ./scripts
15
- COPY fastapi_app/templates ./templates
16
-
17
- # Create cache directory for model downloads
18
- RUN mkdir -p /app/.cache && \
19
- useradd -m -u 1000 appuser && \
20
- chown -R appuser:appuser /app
21
-
22
- USER appuser
23
-
24
- EXPOSE 8000
25
-
26
- HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
27
- CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
28
-
29
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ build-essential \
7
+ && rm -rf /var/lib/apt/lists/*
8
+
9
+ COPY fastapi_app/requirements.txt .
10
+ RUN pip install --no-cache-dir -r requirements.txt
11
+
12
+ # Copy application code (excluding models directory)
13
+ COPY fastapi_app/app.py .
14
+ COPY fastapi_app/scripts ./scripts
15
+ COPY fastapi_app/templates ./templates
16
+
17
+ # Create cache directory for model downloads
18
+ RUN mkdir -p /app/.cache && \
19
+ useradd -m -u 1000 appuser && \
20
+ chown -R appuser:appuser /app
21
+
22
+ USER appuser
23
+
24
+ EXPOSE 8000
25
+
26
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
27
+ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
28
+
29
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]