btf / Dockerfile
jameshns's picture
Update Dockerfile
031b83a verified
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM python:3.13
RUN useradd -m -u 1000 user
#run chattr -i /etc/resolv.conf
#RUN mkdir /etc/dhcp/
#RUN echo 'supersede domain-name-servers 8.8.8.8;' > /etc/dhcp/dhclient.conf
# RUN apt-get update
# RUN apt-get install -y -q dnsmasq
# RUN echo 'listen-address=127.0.0.1' >> /etc/dnsmasq.conf
# RUN echo 'resolv-file=/etc/resolv.dnsmasq.conf' >> /etc/dnsmasq.conf
# RUN echo 'conf-dir=/etc/dnsmasq.d' >> /etc/dnsmasq.conf
# RUN echo 'user=root' >> /etc/dnsmasq.conf
# RUN echo 'nameserver 8.8.8.8' >> /etc/resolv.dnsmasq.conf
# RUN echo 'nameserver 8.8.4.4' >> /etc/resolv.dnsmasq.conf
# RUN echo 'address="/mydomain/127.0.6.1"' >> /etc/dnsmasq.d/0hosts
# RUN service dnsmasq start
# expose 53
#RUN echo 'nameserver 8.8.8.8' >> /etc/resolv.conf
# RUN ls -la /etc/resolv.conf
# COPY resolv.conf /etc/resolv.conf
# RUN ls -la /etc/resolv.conf
# RUN cat /etc/resolv.conf
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY --chown=user . /app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
#CMD echo sudo "nameserver 8.8.8.8" > /etc/resolv.conf && uvicorn app:app --host 0.0.0.0 --port 7860
#echo "nameserver XX.XX.1.1" > /etc/resolv.conf
# CMD ["sh", "-c", "echo 'nameserver 8.8.8.8' > /etc/resolv.conf && exec uvicorn app:app --host 0.0.0.0 --port 7860"]