kjkjk
This commit is contained in:
32
Dockerfile
32
Dockerfile
@ -2,22 +2,19 @@
|
||||
FROM python:3.9-slim AS builder
|
||||
|
||||
# Set environment variables to avoid interactive prompts
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Update package lists and install build dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
# Configure apt to use reliable mirrors
|
||||
RUN echo "deb http://ftp.debian.org/debian bookworm main" > /etc/apt/sources.list && \
|
||||
echo "deb http://ftp.debian.org/debian-security bookworm-security main" >> /etc/apt/sources.list && \
|
||||
echo "deb http://ftp.us.debian.org/debian bookworm main" >> /etc/apt/sources.list
|
||||
|
||||
# Install build dependencies and clean up in one step
|
||||
RUN apt-get update -o Acquire::Retries=10 -o Acquire::http::Timeout=30 && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc \
|
||||
g++ \
|
||||
libc6-dev \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
make \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Upgrade pip to latest version
|
||||
RUN pip install --upgrade pip
|
||||
python3-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install MkDocs and plugins with exact versions
|
||||
RUN pip install --no-cache-dir \
|
||||
@ -41,11 +38,6 @@ RUN mkdocs build --strict
|
||||
# Runtime stage
|
||||
FROM python:3.9-slim
|
||||
|
||||
# Install wget for healthcheck
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
wget \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /site
|
||||
|
||||
@ -57,7 +49,7 @@ EXPOSE 80
|
||||
|
||||
# Healthcheck to ensure the server is running
|
||||
HEALTHCHECK --interval=30s --timeout=3s \
|
||||
CMD wget -qO- http://localhost:80/ || exit 1
|
||||
CMD curl -f http://localhost:80/ || exit 1
|
||||
|
||||
# Serve the static site with Python's http.server
|
||||
CMD ["python", "-m", "http.server", "80"]
|
||||
Reference in New Issue
Block a user