Kaballas commited on
Commit
67d83e0
·
1 Parent(s): 8bba362
Files changed (2) hide show
  1. Dockerfile +11 -1
  2. entrypoint.sh +16 -0
Dockerfile CHANGED
@@ -6,6 +6,11 @@ FROM python:3.9
6
  # Switch to root user to perform administrative tasks
7
  USER root
8
 
 
 
 
 
 
9
  # Create storage directory and link
10
  RUN mkdir -p /data/storage \
11
  && ln -s /data/storage /storage
@@ -18,6 +23,10 @@ RUN useradd -m -u 1000 user \
18
  ENV STORAGE_DIR="/data/storage"
19
  ENV SERVER_PORT=7860
20
 
 
 
 
 
21
  USER user
22
  ENV PATH="/home/user/.local/bin:$PATH"
23
 
@@ -27,4 +36,5 @@ COPY --chown=user ./requirements.txt requirements.txt
27
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
28
 
29
  COPY --chown=user . /app
30
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
6
  # Switch to root user to perform administrative tasks
7
  USER root
8
 
9
+ # Install MariaDB server and client
10
+ RUN apt-get update \
11
+ && apt-get install -y mariadb-server mariadb-client \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
  # Create storage directory and link
15
  RUN mkdir -p /data/storage \
16
  && ln -s /data/storage /storage
 
23
  ENV STORAGE_DIR="/data/storage"
24
  ENV SERVER_PORT=7860
25
 
26
+ # Copy entrypoint script
27
+ COPY entrypoint.sh /entrypoint.sh
28
+ RUN chmod +x /entrypoint.sh
29
+
30
  USER user
31
  ENV PATH="/home/user/.local/bin:$PATH"
32
 
 
36
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
37
 
38
  COPY --chown=user . /app
39
+
40
+ ENTRYPOINT ["/entrypoint.sh"]
entrypoint.sh ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Start MariaDB in the background
5
+ sudo service mysql start
6
+
7
+ # Wait for MariaDB to be ready
8
+ until mysqladmin ping --silent; do
9
+ echo 'Waiting for MariaDB to start...'
10
+ sleep 1
11
+ done
12
+
13
+ echo 'MariaDB started.'
14
+
15
+ # Start the Python app (foreground)
16
+ exec uvicorn app:app --host 0.0.0.0 --port 7860