Files
Key-service-Server/Website/Dockerfile
T
Aiirondev_dev 83abe0aab9 Refactor Docker setup and enhance MongoDB connection handling
- Updated Dockerfile to use Gunicorn for serving the Flask application instead of the default Python command.
- Modified docker-compose.yml to set memory limits and reservations for MongoDB and the web service.
- Enhanced main.py with improved MongoDB connection management using a thread-safe singleton pattern and added environment variable configurations for connection pooling.
- Introduced new utility functions for system monitoring, including uptime, load averages, and disk usage.
- Added backup and restore functionality for instances, including routes for exporting and importing backups.
- Removed the live monitor section from admin_instances.html and updated admin_system.html to include a comprehensive server management dashboard with KPIs and usage charts.
- Added a new gunicorn configuration file for better performance tuning.
- Updated requirements.txt to include Gunicorn as a dependency.
2026-04-14 23:04:51 +02:00

44 lines
1.4 KiB
Docker

FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
iproute2 \
docker.io \
curl \
openssl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN set -eu; \
arch="$(dpkg --print-architecture)"; \
case "$arch" in \
amd64) compose_arch="x86_64" ;; \
arm64) compose_arch="aarch64" ;; \
*) echo "Unsupported architecture for compose plugin: $arch"; exit 1 ;; \
esac; \
curl -fsSL "https://download.docker.com/linux/static/stable/${compose_arch}/docker-27.1.1.tgz" \
-o /tmp/docker.tgz; \
tar -xzf /tmp/docker.tgz -C /tmp; \
install -m 0755 /tmp/docker/docker /usr/local/bin/docker; \
rm -rf /tmp/docker /tmp/docker.tgz; \
mkdir -p /usr/libexec/docker/cli-plugins; \
curl -fsSL "https://github.com/docker/compose/releases/download/v2.29.7/docker-compose-linux-${compose_arch}" \
-o /usr/libexec/docker/cli-plugins/docker-compose; \
chmod +x /usr/libexec/docker/cli-plugins/docker-compose
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN chmod +x /app/provision_instance.sh
EXPOSE 4999
CMD ["gunicorn", "-c", "gunicorn.conf.py", "main:app"]