diff --git a/Dockerfile b/Dockerfile index b9b0649..430bc5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,20 @@ # Build stage FROM python:3.9-slim AS builder -# Install MkDocs, Material for MkDocs, and plugins -RUN pip install --no-cache-dir mkdocs mkdocs-material mkdocs-macros-plugin +# Install build dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + gcc \ + python3-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install MkDocs and plugins with exact versions for faster resolution +RUN pip install --no-cache-dir \ + mkdocs==1.6.1 \ + mkdocs-material==9.5.39 \ + mkdocs-macros-plugin==1.2.0 \ + mkdocs-minify-plugin==0.8.0 \ + mkdocs-awesome-pages-plugin==2.9.2 \ + mkdocs-glightbox==0.4.0 # Set working directory WORKDIR /docs @@ -11,24 +23,24 @@ WORKDIR /docs COPY mkdocs.yml . COPY docs/ ./docs/ -# Validate configuration and build site with strict mode +# Build the static site with strict mode RUN mkdocs build --strict -# Production stage -FROM nginx:alpine +# Runtime stage +FROM python:3.9-slim + +# Set working directory +WORKDIR /site # Copy the built site from the builder stage -COPY --from=builder /docs/site /usr/share/nginx/html - -# Copy custom Nginx configuration -COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=builder /docs/site . # Expose port 80 EXPOSE 80 -# Healthcheck to ensure Nginx is running +# Healthcheck to ensure the server is running HEALTHCHECK --interval=30s --timeout=3s \ - CMD curl -f http://localhost/ || exit 1 + CMD curl -f http://localhost:80/ || exit 1 -# Start Nginx -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +# Serve the static site with Python's http.server +CMD ["python", "-m", "http.server", "80"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 2bb97bc..e3a28f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,14 +8,14 @@ services: image: mkdocs-material-prod ports: - "8085:80" - environment: - - NGINX_WORKER_PROCESSES=1 - - NGINX_WORKER_CONNECTIONS=1024 volumes: - - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro + - ./mkdocs.yml:/docs/mkdocs.yml:ro + - ./docs:/docs/docs:ro + environment: + - PYTHONUNBUFFERED=1 restart: unless-stopped healthcheck: - test: ["CMD", "curl", "-f", "http://localhost/"] + test: ["CMD", "curl", "-f", "http://localhost:80/"] interval: 30s timeout: 3s retries: 3 \ No newline at end of file