Enhance Docker Setup with User Management, Logging, and Startup Script

This commit enhances the Docker setup by:
- Creating a dedicated programmer user with UID 1000
- Adding logrotate for log management
- Updating the Dockerfile to use the new user and expose port 7860
- Adding a startup script to manage MCP server and Open Code processes
- Updating the Makefile to include interactive mode and container naming
- Configuring log rotation for server logs
This commit is contained in:
2026-01-28 16:56:35 +01:00
parent bc66c794a5
commit 62b53f26f0
4 changed files with 55 additions and 5 deletions

View File

@@ -5,6 +5,9 @@ FROM python:3.11-slim
RUN echo "deb http://deb.debian.org/debian testing main" \
> /etc/apt/sources.list.d/testing.list
# Création d'un utilisateur programmeur avec UID 1000 et home dans /home/programmer
RUN useradd -u 1000 -m -d /home/programmer -s /bin/bash programmer
WORKDIR /app
# Installer les outils de développement Go et Rust
@@ -24,7 +27,8 @@ RUN apt-get update && \
black \
flake8 \
mypy \
isort
isort \
logrotate
COPY tools tools
@@ -50,12 +54,30 @@ RUN cargo binstall --strategies crate-meta-data jj-cli
# Installer le SDK MCP Python
RUN pip install --no-cache-dir ruff fastmcp ipython
RUN curl -fsSL https://opencode.ai/install | bash \
&& mv /root/.opencode/bin/opencode /usr/local/bin/
# Copier le serveur
COPY src .
# Copier le script de démarrage
COPY docker_startup.sh .
COPY opencode.json ~/.config/opencode
# Exposer le port
EXPOSE 6666
EXPOSE 7860
ENV OLLAMA_ADDR="http://host.docker.internal:11434"
# Lancer le serveur
CMD ["python", "./PMOCrazyCoder.py"]
# Rendre le script exécutable et lancer le serveur
RUN chmod +x docker_startup.sh
RUN mkdir /sandbox /log \
&& chown programmer:programmer /sandbox /log
# Création de la configuration logrotate
COPY logrotate-config /etc/logrotate.d/mcp-logs
# Changer l'utilisateur pour programmeur
USER programmer
RUN mkdir -p /home/programmer/.config/opencode
COPY opencode.json /home/programmer/.config/opencode
CMD ["./docker_startup.sh"]