#FROM python:3.9 | |
FROM alpine:3.18 | |
RUN apk update && apk add --no-cache iputils | |
# The two following lines are requirements for the Dev Mode to be functional | |
# Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers | |
#RUN useradd -m -u 1000 user | |
#añade usuario: (alpine) | |
RUN adduser -D -u 1000 user | |
# Copia el archivo requirements.txt al contenedor: (alpine) | |
COPY requirements.txt . | |
#instalo bash: (alpine) | |
RUN apk add --no-cache bash | |
#instalo curl: (alpine) | |
RUN apk add --no-cache curl | |
#instalo wget: (alpine) | |
RUN apk add --no-cache wget | |
#instalo vind-tools para poder hacer un nslookup a la api de telegram para chequear dns: (alpine) | |
RUN apk add --no-cache bind-tools | |
#instalo tor para usar con curl | |
RUN apk add --no-cache tor | |
#instala python y dependencias: (alpine) | |
RUN apk add --no-cache python3 py3-pip && pip3 install --no-cache-dir -r requirements.txt | |
#cambio al nuevo usuario | |
USER user | |
WORKDIR /code | |
#COPY --chown=user ./requirements.txt /code/requirements.txt | |
#RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
COPY --chown=user ./app.py /code/app.py | |
COPY --chown=user ./envia_mensaje.py /code/envia_mensaje.py | |
COPY --chown=user ./envia_mensaje.sh /code/envia_mensaje.sh | |
RUN chmod +x /code/envia_mensaje.sh # añado permisos de ejecución | |
#agrego nameservers a ver si soluciona el error de conexción con telegram | |
#RUN echo "nameserver 8.8.8.8" >> /etc/resolv.conf | |
#RUN echo "nameserver 4.2.2.1" >> /etc/resolv.conf | |
#RUN echo "nameserver 2001:4860:4860::8844" >> /etc/resolv.conf | |
#RUN echo "nameserver 2001:4860:4860::8888" >> /etc/resolv.conf | |
#RUN export HOSTNAME="maquinola" | |
#RUN echo $HOSTNAME | |
# Establecer servidores DNS, esto no anda, no tengo permisos | |
#RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf | |
# Expose the port (no funca) | |
EXPOSE 7860 | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |
#CMD ["python", "app.py"] | |