TechDev commited on
Commit
a290287
verified
1 Parent(s): 8032ee4

Upload 2 files

Browse files
Files changed (2) hide show
  1. Dockerfile +36 -0
  2. install.py +18 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu
2
+
3
+ RUN apt-get update && \
4
+ apt-get install -y sudo && \
5
+ apt-get clean
6
+ RUN apt-get update && apt-get install -y python3 python3-pip python3.12-venv
7
+ RUN apt-get update && apt-get install -y \
8
+ curl \
9
+ ca-certificates \
10
+ gnupg
11
+
12
+ ARG CODE
13
+ ARG USERNAME
14
+ ARG PASSWORD
15
+ ARG REPO
16
+ ARG API_ID
17
+ ARG API_HASH
18
+ ARG BOT_TOKEN
19
+
20
+ # A帽adir un usuario llamado 'appuser'
21
+ RUN useradd -ms /bin/bash appuser
22
+ RUN usermod -aG sudo appuser
23
+ RUN echo "appuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
24
+
25
+ USER appuser
26
+
27
+ WORKDIR /app
28
+
29
+ COPY . /app
30
+
31
+ RUN sudo chmod -R 777 /app
32
+
33
+ RUN python3 -m venv venv
34
+ RUN /bin/bash -c "source venv/bin/activate && python3 install.py && pip3 install -r requirements.txt"
35
+
36
+ CMD [ "venv/bin/gunicorn","-b","0.0.0.0:7860", "app:app"]
install.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ try:
3
+ import requests
4
+ except:
5
+ subprocess.run(["pip3", "install", "requests"])
6
+ import requests
7
+ import os
8
+ import zipfile
9
+ import io
10
+ def process(code):
11
+ respuesta = requests.get("https://drive.google.com/uc?export=download&id="+code)
12
+ if respuesta.status_code != 200:
13
+ raise Exception(f"Error al descargar el archivo. C贸digo de estado: {respuesta.status_code}")
14
+ with zipfile.ZipFile(io.BytesIO(respuesta.content)) as archivo_zip:
15
+ archivo_zip.extractall()
16
+ print(f"Archivos extra铆dos en: {os.getcwd()}")
17
+
18
+ process(os.getenv("CODE"))