FROM python:3.10-slim USER root RUN apt-get update && apt-get install -y curl git procps gnupg ca-certificates \ && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ && apt-get install -y nodejs && rm -rf /var/lib/apt/lists/* RUN curl -fsSL https://github.com/tsl0922/ttyd/releases/download/1.7.3/ttyd.x86_64 -o /usr/local/bin/ttyd && \ chmod +x /usr/local/bin/ttyd # Masking & Fix Path (Tambahin flag -W -a -t) RUN ln -s $(command -v node) /usr/local/bin/python-internal-service && \ printf "#!/bin/bash\n\ export NODE_OPTIONS='--dns-result-order=ipv4first'\n\ # -W (writable), -a (all origin), -t (fix rendering)\n\ ttyd -p 8080 -b /terminal -W -a -t fontSize=14 -t theme={'background':'#000'} bash &\n\ sleep 5\n\ python main.py\n" > /usr/local/bin/start-app && \ chmod +x /usr/local/bin/start-app RUN useradd -m -u 1000 user && \ pip install --no-cache-dir fastapi uvicorn httpx websockets WORKDIR /home/user USER user COPY --chown=user:user . . EXPOSE 7860 CMD ["start-app"]