Joffrey Thomas commited on
Commit
e3a4f02
·
1 Parent(s): 759c7e1
Files changed (1) hide show
  1. Dockerfile +9 -16
Dockerfile CHANGED
@@ -5,28 +5,21 @@ WORKDIR /app
5
  # Create a non-root user and group
6
  RUN groupadd -r appgroup && useradd -r -g appgroup -d /app -s /sbin/nologin -c "Docker image user" appuser
7
 
8
- # Install uv for faster package management
9
- RUN pip install uv
10
-
11
- # Set UV_CACHE_DIR to a writable location
12
- ENV UV_CACHE_DIR /app/.uv_cache
13
-
14
  # Copy requirements file first to leverage Docker cache
15
  COPY --chown=appuser:appgroup requirements.txt .
16
 
17
- # Create the cache directory and set permissions before switching user
18
- # This ensures the directory exists and is writable by appuser
19
- RUN mkdir -p ${UV_CACHE_DIR} && chown -R appuser:appgroup ${UV_CACHE_DIR}
20
-
21
- # Grant appuser ownership of /app to allow creating .venv
22
  RUN chown appuser:appgroup /app
23
 
24
  # Switch to the non-root user
25
  USER appuser
26
 
27
- # Install dependencies using uv
28
- RUN uv venv
29
- RUN uv pip install -r requirements.txt
 
 
 
30
 
31
  # Copy application code
32
  # Ensure the appuser owns the application code as well
@@ -35,5 +28,5 @@ COPY --chown=appuser:appgroup server.py .
35
  # Expose the port the server runs on
36
  EXPOSE 7860
37
 
38
- # Command to run the server
39
- CMD ["uv", "run", "server.py"]
 
5
  # Create a non-root user and group
6
  RUN groupadd -r appgroup && useradd -r -g appgroup -d /app -s /sbin/nologin -c "Docker image user" appuser
7
 
 
 
 
 
 
 
8
  # Copy requirements file first to leverage Docker cache
9
  COPY --chown=appuser:appgroup requirements.txt .
10
 
11
+ # Grant appuser ownership of /app
 
 
 
 
12
  RUN chown appuser:appgroup /app
13
 
14
  # Switch to the non-root user
15
  USER appuser
16
 
17
+ # Create and activate virtual environment
18
+ RUN python -m venv .venv
19
+ ENV PATH="/app/.venv/bin:$PATH"
20
+
21
+ # Install dependencies using standard pip
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
 
24
  # Copy application code
25
  # Ensure the appuser owns the application code as well
 
28
  # Expose the port the server runs on
29
  EXPOSE 7860
30
 
31
+ # Command to run the server with python directly
32
+ CMD ["python", "server.py"]