File size: 925 Bytes
ed844ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FROM python:3.9-slim

# 1. Install Database Servers and CLIs
# We install sqlite3, postgresql-client, and mariadb-client
# Reordered slightly to ensure Docker rebuilds this layer and installs sqlite3
RUN apt-get update && apt-get install -y \
    sqlite3 \
    postgresql \
    postgresql-client \
    mariadb-server \
    mariadb-client \
    && rm -rf /var/lib/apt/lists/*

# 2. Set up Python environment
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# 3. Copy application code & startup script
COPY app.py .
COPY start.sh .
RUN chmod +x start.sh

# 4. Fix Permissions for DB startup
RUN mkdir -p /var/run/mysqld && \
    chown -R postgres:postgres /var/lib/postgresql && \
    chown -R mysql:mysql /var/lib/mysql && \
    chown -R mysql:mysql /var/run/mysqld

# 5. Expose the Hugging Face default port
EXPOSE 7860

# 6. Use the startup script as the entrypoint
CMD ["./start.sh"]