Create Dockerfile
Browse files- Dockerfile +61 -0
Dockerfile
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
+
# you will also find guides on how best to write your Dockerfile
|
| 3 |
+
FROM debian:bookworm-slim
|
| 4 |
+
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
+
|
| 7 |
+
# Systempakete installieren
|
| 8 |
+
RUN apt-get update && \
|
| 9 |
+
apt-get install -y openssh-server sudo git nano curl npm && \
|
| 10 |
+
mkdir /var/run/sshd
|
| 11 |
+
|
| 12 |
+
# Benutzer "pi" erstellen
|
| 13 |
+
RUN useradd -m -s /bin/bash pi && \
|
| 14 |
+
echo "pi:asdfmnbv" | chpasswd && \
|
| 15 |
+
usermod -aG sudo pi
|
| 16 |
+
|
| 17 |
+
# SSH-Konfiguration anpassen
|
| 18 |
+
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin no/' /etc/ssh/sshd_config && \
|
| 19 |
+
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
|
| 20 |
+
|
| 21 |
+
# Installationsskript für Node.js, npm und pnpm nach /root/1.sh schreiben
|
| 22 |
+
RUN cat <<EOF > /root/1.sh
|
| 23 |
+
#!/bin/bash
|
| 24 |
+
apt update && apt install -y curl npm
|
| 25 |
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
|
| 26 |
+
export NVM_DIR="\$HOME/.nvm"
|
| 27 |
+
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
| 28 |
+
nvm install node
|
| 29 |
+
npm install -g pnpm
|
| 30 |
+
EOF
|
| 31 |
+
|
| 32 |
+
RUN chmod +x /root/1.sh
|
| 33 |
+
|
| 34 |
+
# Installationsskript für Bolt nach /home/pi/1.sh schreiben
|
| 35 |
+
RUN cat <<EOF > /home/pi/1.sh
|
| 36 |
+
#!/bin/bash
|
| 37 |
+
cd /home/pi
|
| 38 |
+
git clone https://github.com/stackblitz-labs/bolt.diy.git bolt
|
| 39 |
+
cd bolt
|
| 40 |
+
pnpm install
|
| 41 |
+
|
| 42 |
+
pnpm run dev --host 0.0.0.0
|
| 43 |
+
EOF
|
| 44 |
+
|
| 45 |
+
RUN chmod +x /home/pi/1.sh && chown pi:pi /home/pi/1.sh
|
| 46 |
+
|
| 47 |
+
# Container Startbefehl
|
| 48 |
+
CMD ["/usr/sbin/sshd", "-D"]
|
| 49 |
+
FROM python:3.9
|
| 50 |
+
|
| 51 |
+
RUN useradd -m -u 1000 user
|
| 52 |
+
USER user
|
| 53 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 54 |
+
|
| 55 |
+
WORKDIR /app
|
| 56 |
+
|
| 57 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 58 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 59 |
+
|
| 60 |
+
COPY --chown=user . /app
|
| 61 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|