samarth upadhyay commited on
Commit
ed844ff
·
verified ·
1 Parent(s): 60361dd

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ # 1. Install Database Servers and CLIs
4
+ # We install sqlite3, postgresql-client, and mariadb-client
5
+ # Reordered slightly to ensure Docker rebuilds this layer and installs sqlite3
6
+ RUN apt-get update && apt-get install -y \
7
+ sqlite3 \
8
+ postgresql \
9
+ postgresql-client \
10
+ mariadb-server \
11
+ mariadb-client \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # 2. Set up Python environment
15
+ WORKDIR /app
16
+ COPY requirements.txt .
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # 3. Copy application code & startup script
20
+ COPY app.py .
21
+ COPY start.sh .
22
+ RUN chmod +x start.sh
23
+
24
+ # 4. Fix Permissions for DB startup
25
+ RUN mkdir -p /var/run/mysqld && \
26
+ chown -R postgres:postgres /var/lib/postgresql && \
27
+ chown -R mysql:mysql /var/lib/mysql && \
28
+ chown -R mysql:mysql /var/run/mysqld
29
+
30
+ # 5. Expose the Hugging Face default port
31
+ EXPOSE 7860
32
+
33
+ # 6. Use the startup script as the entrypoint
34
+ CMD ["./start.sh"]