Kaballas commited on
Commit
377105f
Β·
1 Parent(s): ce66478
Files changed (1) hide show
  1. Dockerfile +7 -4
Dockerfile CHANGED
@@ -16,8 +16,9 @@ RUN curl -LsSO https://r.mariadb.com/downloads/mariadb_repo_setup && \
16
  # ── Python tooling ────────────────────────────────────────────────
17
  RUN pip install --no-cache-dir uv==0.1.37
18
 
19
- RUN useradd -m -u 1000 user
20
 
 
 
21
  WORKDIR /app
22
  # Copy project files
23
  COPY . /app
@@ -33,8 +34,10 @@ RUN uv pip install -e . --system && \
33
  # Fix permissions so the unprivileged user can write to /app and .egg-info
34
  RUN chown -R user:user /app
35
 
36
- # ── Unprivileged user ─────────────────────────────────────────────
37
- USER user
 
 
38
 
39
  ENV HOME=/home/user \
40
  PATH=/home/user/.local/bin:$PATH \
@@ -44,6 +47,6 @@ ENV HOME=/home/user \
44
 
45
  EXPOSE 7860
46
 
47
- # Run the server using uvicorn with app.py as the entrypoint
48
  ENTRYPOINT ["/app/entrypoint.sh"]
49
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
16
  # ── Python tooling ────────────────────────────────────────────────
17
  RUN pip install --no-cache-dir uv==0.1.37
18
 
 
19
 
20
+ # MariaDB needs to run as root or mysql user for permissions on /var/lib/mysql
21
+ # We'll run the app as user later, but keep root for DB startup
22
  WORKDIR /app
23
  # Copy project files
24
  COPY . /app
 
34
  # Fix permissions so the unprivileged user can write to /app and .egg-info
35
  RUN chown -R user:user /app
36
 
37
+ # Ensure /var/lib/mysql exists and is owned by root (MariaDB default)
38
+ RUN mkdir -p /var/lib/mysql && chown -R root:root /var/lib/mysql
39
+
40
+ # ── Remain as root for DB startup ──
41
 
42
  ENV HOME=/home/user \
43
  PATH=/home/user/.local/bin:$PATH \
 
47
 
48
  EXPOSE 7860
49
 
50
+ # Entrypoint starts MariaDB, waits, then launches app
51
  ENTRYPOINT ["/app/entrypoint.sh"]
52
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]