kjkjk
This commit is contained in:
32
Dockerfile
32
Dockerfile
@ -2,22 +2,19 @@
|
|||||||
FROM python:3.9-slim AS builder
|
FROM python:3.9-slim AS builder
|
||||||
|
|
||||||
# Set environment variables to avoid interactive prompts
|
# Set environment variables to avoid interactive prompts
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
PYTHONUNBUFFERED=1 \
|
|
||||||
DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
# Update package lists and install build dependencies
|
# Configure apt to use reliable mirrors
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
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 \
|
gcc \
|
||||||
g++ \
|
python3-dev && \
|
||||||
libc6-dev \
|
rm -rf /var/lib/apt/lists/*
|
||||||
libffi-dev \
|
|
||||||
libssl-dev \
|
|
||||||
make \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Upgrade pip to latest version
|
|
||||||
RUN pip install --upgrade pip
|
|
||||||
|
|
||||||
# Install MkDocs and plugins with exact versions
|
# Install MkDocs and plugins with exact versions
|
||||||
RUN pip install --no-cache-dir \
|
RUN pip install --no-cache-dir \
|
||||||
@ -41,11 +38,6 @@ RUN mkdocs build --strict
|
|||||||
# Runtime stage
|
# Runtime stage
|
||||||
FROM python:3.9-slim
|
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
|
# Set working directory
|
||||||
WORKDIR /site
|
WORKDIR /site
|
||||||
|
|
||||||
@ -57,7 +49,7 @@ EXPOSE 80
|
|||||||
|
|
||||||
# Healthcheck to ensure the server is running
|
# Healthcheck to ensure the server is running
|
||||||
HEALTHCHECK --interval=30s --timeout=3s \
|
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
|
# Serve the static site with Python's http.server
|
||||||
CMD ["python", "-m", "http.server", "80"]
|
CMD ["python", "-m", "http.server", "80"]
|
||||||
Reference in New Issue
Block a user