| FROM ubuntu:22.04 |
|
|
| ENV DEBIAN_FRONTEND=noninteractive |
|
|
| RUN apt-get update && apt-get install -y \ |
| python3 \ |
| python3-pip \ |
| sudo \ |
| wget \ |
| curl \ |
| git \ |
| vim \ |
| nano \ |
| htop \ |
| net-tools \ |
| iputils-ping \ |
| build-essential \ |
| openssh-server \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| RUN mkdir /var/run/sshd && \ |
| echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config && \ |
| echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config |
|
|
| RUN useradd -m -u 1000 -s /bin/bash ubuntu && \ |
| echo "ubuntu:huggingface" | chpasswd && \ |
| usermod -aG sudo ubuntu && \ |
| echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/ubuntu |
|
|
| WORKDIR /app |
|
|
| COPY requirements.txt . |
| RUN pip3 install --no-cache-dir -r requirements.txt |
|
|
| COPY app.py . |
|
|
| RUN chown -R ubuntu:ubuntu /app |
|
|
| EXPOSE 7860 |
| EXPOSE 22 |
|
|
| USER ubuntu |
|
|
| CMD ["bash", "-c", "sudo /usr/sbin/sshd && python3 app.py"] |