taslim19 commited on
Commit
dc005eb
·
1 Parent(s): 14c5067

Fix bot database file issue and clean up Dockerfile

Browse files
Files changed (2) hide show
  1. Dockerfile +4 -9
  2. OneApi/__init__.py +4 -2
Dockerfile CHANGED
@@ -22,9 +22,10 @@ COPY . .
22
 
23
  # Create necessary directories and set permissions
24
  RUN mkdir -p /app/logs && \
 
25
  touch /app/log.txt && \
26
- chmod 666 /app/log.txt
27
- RUN pip3 install uvicorn fastapi
28
 
29
  # Expose port
30
  EXPOSE 8080
@@ -33,15 +34,9 @@ EXPOSE 8080
33
  ENV PYTHONPATH=/app
34
  ENV PORT=8080
35
 
36
-
37
-
38
-
39
  # Health check
40
  HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
41
  CMD curl -f http://localhost:8080/ || exit 1
42
 
43
  # Run the application
44
- COPY start.sh /app/start.sh
45
- RUN chmod +x /app/start.sh
46
-
47
- CMD ["/app/start.sh"]
 
22
 
23
  # Create necessary directories and set permissions
24
  RUN mkdir -p /app/logs && \
25
+ mkdir -p /tmp && \
26
  touch /app/log.txt && \
27
+ chmod 666 /app/log.txt && \
28
+ chmod 777 /tmp
29
 
30
  # Expose port
31
  EXPOSE 8080
 
34
  ENV PYTHONPATH=/app
35
  ENV PORT=8080
36
 
 
 
 
37
  # Health check
38
  HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
39
  CMD curl -f http://localhost:8080/ || exit 1
40
 
41
  # Run the application
42
+ CMD ["python", "-m", "OneApi"]
 
 
 
OneApi/__init__.py CHANGED
@@ -26,8 +26,10 @@ if not API_ID or not API_HASH or not TOKEN or not MONGO_DB_URI:
26
  raise ValueError("Bro thought he can run anything lol, i mean you forgot some vars put on variables.py")
27
  exit()
28
  # _-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_|
29
- if len(TOKEN) > 50: bot = Client("OneApi", session_string=TOKEN, api_id=API_ID, api_hash=API_HASH, plugins=dict(root="OneApi/pyro"))
30
- else: bot = Client("OneApi", bot_token=TOKEN, api_id=API_ID, api_hash=API_HASH, plugins=dict(root="OneApi/pyro"))
 
 
31
 
32
  # Bot command handlers
33
  @bot.on_message(filters.command("start"))
 
26
  raise ValueError("Bro thought he can run anything lol, i mean you forgot some vars put on variables.py")
27
  exit()
28
  # _-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_-_+_|
29
+ if len(TOKEN) > 50:
30
+ bot = Client("OneApi", session_string=TOKEN, api_id=API_ID, api_hash=API_HASH, plugins=dict(root="OneApi/pyro"))
31
+ else:
32
+ bot = Client("OneApi", bot_token=TOKEN, api_id=API_ID, api_hash=API_HASH, plugins=dict(root="OneApi/pyro"), workdir="/tmp")
33
 
34
  # Bot command handlers
35
  @bot.on_message(filters.command("start"))