| # Use the official Python image as the base | |
| FROM python:3.9-slim | |
| # Install dependencies for code-server | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| git \ | |
| && curl -fsSL https://code-server.dev/install.sh | sh | |
| # Create a non-root user | |
| RUN useradd -m coder && \ | |
| mkdir -p /home/coder/.config && \ | |
| chown -R coder:coder /home/coder | |
| # Set working directory | |
| WORKDIR /app | |
| # Switch to non-root user | |
| USER coder | |
| # Expose port 8080 for code-server | |
| EXPOSE 8080 | |
| # Start code-server | |
| CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none"] | |