xdragxt commited on
Commit
a5e182d
·
verified ·
1 Parent(s): 9835444

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -18
Dockerfile CHANGED
@@ -1,9 +1,10 @@
1
  FROM python:3.10-slim
2
 
 
3
  ENV TZ=Asia/Kolkata
4
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
5
 
6
- # Install required system packages (fixed syntax)
7
  RUN apt-get update && apt-get install -y --no-install-recommends \
8
  gdb \
9
  git \
@@ -17,31 +18,32 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
17
  # Set working directory
18
  WORKDIR /app
19
 
20
- # Copy all files to container
21
  COPY . .
22
 
23
- # Avoid pip install as root errors
24
  ENV PIP_ROOT_USER_ACTION=ignore
25
 
26
- # Upgrade pip and install Python requirements
27
- RUN pip install --upgrade pip
28
- RUN pip install --no-cache-dir -r requirements.txt
29
- RUN pip install uvicorn fastapi
30
 
31
- # Optional: Run installer if needed
32
- RUN bash installer.sh || true
33
 
34
- # Fix Git 'dubious ownership' issue safely
35
  RUN git config --system --add safe.directory /app
36
 
37
- # Ensure writable directories
38
- RUN mkdir -p /app/sessions && chmod -R 777 /app/sessions
39
- RUN mkdir -p /app/resources/auth && chmod -R 777 /app/resources
40
- RUN mkdir -p /app/tmp && chmod -R 777 /app/tmp
41
- RUN mkdir -p /app/pdf && chmod -R 777 /app/pdf
42
 
43
- # Set Python path explicitly
44
  ENV PYTHONPATH="${PYTHONPATH}:/app"
45
 
46
- # Start the bot
47
- CMD bash startup & python3 server.py
 
 
 
 
 
1
  FROM python:3.10-slim
2
 
3
+ # Set timezone
4
  ENV TZ=Asia/Kolkata
5
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
6
 
7
+ # Install required system packages
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
9
  gdb \
10
  git \
 
18
  # Set working directory
19
  WORKDIR /app
20
 
21
+ # Copy project files
22
  COPY . .
23
 
24
+ # Avoid pip permission issues
25
  ENV PIP_ROOT_USER_ACTION=ignore
26
 
27
+ # Install Python dependencies
28
+ RUN pip install --upgrade pip && \
29
+ pip install --no-cache-dir -r requirements.txt
 
30
 
31
+ # (Optional) Skip or modify if installer.sh fails
32
+ RUN [ -f installer.sh ] && bash installer.sh || true
33
 
34
+ # Fix Git ownership warning
35
  RUN git config --system --add safe.directory /app
36
 
37
+ # Set folder permissions
38
+ RUN mkdir -p /app/sessions /app/resources/auth /app/tmp /app/pdf && \
39
+ chmod -R 777 /app/sessions /app/resources /app/tmp /app/pdf
 
 
40
 
41
+ # Set PYTHONPATH
42
  ENV PYTHONPATH="${PYTHONPATH}:/app"
43
 
44
+ # Copy entrypoint
45
+ COPY entrypoint.sh /app/entrypoint.sh
46
+ RUN chmod +x /app/entrypoint.sh
47
+
48
+ # Run the bot/server
49
+ CMD ["/app/entrypoint.sh"]