Ojochegbeng commited on
Commit
39a502b
·
verified ·
1 Parent(s): 2f5c196

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +37 -38
Dockerfile CHANGED
@@ -1,38 +1,37 @@
1
- # Use Python 3.11 slim image as base
2
- FROM python:3.11-slim
3
-
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Install system dependencies
8
- RUN apt-get update && apt-get install -y \
9
- build-essential \
10
- curl \
11
- software-properties-common \
12
- git \
13
- && rm -rf /var/lib/apt/lists/*
14
-
15
- # Copy requirements first for better caching
16
- COPY requirements.txt .
17
-
18
- # Install Python dependencies
19
- RUN pip install --no-cache-dir -r requirements.txt
20
-
21
- # Copy application files
22
- COPY app.py .
23
- COPY README.md .
24
-
25
- # Create a non-root user
26
- RUN useradd --create-home --shell /bin/bash app \
27
- && chown -R app:app /app
28
- USER app
29
-
30
- # Expose port
31
- EXPOSE 7860
32
-
33
- # Health check
34
- HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
35
- CMD curl -f http://localhost:7860/health || exit 1
36
-
37
- # Run the application
38
- CMD ["python", "app.py"]
 
1
+ # Use Python 3.11 slim image as base
2
+ FROM python:3.11-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ curl \
11
+ git \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Copy requirements first for better caching
15
+ COPY requirements.txt .
16
+
17
+ # Install Python dependencies
18
+ RUN pip install --no-cache-dir -r requirements.txt
19
+
20
+ # Copy application files
21
+ COPY app.py .
22
+ COPY README.md .
23
+
24
+ # Create a non-root user
25
+ RUN useradd --create-home --shell /bin/bash app \
26
+ && chown -R app:app /app
27
+ USER app
28
+
29
+ # Expose port
30
+ EXPOSE 7860
31
+
32
+ # Health check
33
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
34
+ CMD curl -f http://localhost:7860/health || exit 1
35
+
36
+ # Run the application
37
+ CMD ["python", "app.py"]