FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive # Install Node.js 20, Python 3, Caddy, Supervisor, and dependencies RUN apt-get update && apt-get install -y \ debian-keyring debian-archive-keyring apt-transport-https curl supervisor \ python3 python3-pip python3-venv \ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ && apt-get install -y nodejs \ && curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg \ && curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list \ && apt-get update && apt-get install -y caddy \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user WORKDIR /app # Copy backend applications and proxy configuration COPY projects/telegram-send-demo/backend /app/projects/telegram-send-demo/backend COPY projects/k3s-test-app /app/projects/k3s-test-app COPY Caddyfile /etc/caddy/Caddyfile COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Build NestJS Backend (Port 3000) RUN cd /app/projects/telegram-send-demo/backend && npm install && npm run build # Setup Python Virtual Environment & install dependencies for k3s-test-app (Port 8000) RUN python3 -m venv /app/projects/k3s-test-app/.venv \ && /app/projects/k3s-test-app/.venv/bin/pip install --upgrade pip \ && /app/projects/k3s-test-app/.venv/bin/pip install uvicorn fastapi pydantic \ && /app/projects/k3s-test-app/.venv/bin/pip install -e /app/projects/k3s-test-app # Set non-root container permissions RUN chown -R user:user /app /etc/caddy /var/log/supervisor /var/lib/caddy /var/log/caddy USER user EXPOSE 7860 CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]