samarth upadhyay commited on
Commit
07d7799
·
verified ·
1 Parent(s): 0208d9d

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ # 1. Install system dependencies
4
+ # We need Postgres, MariaDB (MySQL), and build tools for python libraries
5
+ RUN apt-get update && apt-get install -y \
6
+ postgresql \
7
+ postgresql-contrib \
8
+ mariadb-server \
9
+ libpq-dev \
10
+ gcc \
11
+ python3-dev \
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. Permissions:
25
+ # Postgres and MySQL don't like running as root.
26
+ # We will fix ownership so we can start them smoothly in the start script.
27
+ RUN mkdir -p /var/run/mysqld && \
28
+ chown -R postgres:postgres /var/lib/postgresql && \
29
+ chown -R mysql:mysql /var/lib/mysql && \
30
+ chown -R mysql:mysql /var/run/mysqld
31
+
32
+ # 5. Expose the Hugging Face default port
33
+ EXPOSE 7860
34
+
35
+ # 6. Use the startup script as the entrypoint
36
+ CMD ["./start.sh"]