File size: 1,809 Bytes
80ed840 84c0a7e 80ed840 618dbb5 84c0a7e 80ed840 618dbb5 19b12aa 80ed840 84c0a7e ebf9655 618dbb5 5f5c6c6 618dbb5 80ed840 618dbb5 3b3e1c3 19b12aa 618dbb5 19b12aa 80ed840 84c0a7e 80ed840 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 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"] |