cc
This commit is contained in:
32
Dockerfile
32
Dockerfile
@ -1,20 +1,24 @@
|
||||
# Build stage
|
||||
FROM python:3.9-slim AS builder
|
||||
FROM python:3.9-alpine AS builder
|
||||
|
||||
# Set environment variables to avoid interactive prompts
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
# Set environment variables
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
# 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
|
||||
# Configure apk to use a reliable mirror
|
||||
RUN echo "https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.18/main" > /etc/apk/repositories && \
|
||||
echo "https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.18/community" >> /etc/apk/repositories
|
||||
|
||||
# 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 \
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache \
|
||||
gcc \
|
||||
python3-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
musl-dev \
|
||||
python3-dev \
|
||||
libffi-dev \
|
||||
openssl-dev \
|
||||
make \
|
||||
linux-headers \
|
||||
glibc # Add glibc compatibility layer for missing symbols
|
||||
|
||||
# Install MkDocs and plugins with exact versions
|
||||
RUN pip install --no-cache-dir \
|
||||
@ -36,7 +40,7 @@ COPY docs/ ./docs/
|
||||
RUN mkdocs build --strict
|
||||
|
||||
# Runtime stage
|
||||
FROM python:3.9-slim
|
||||
FROM python:3.9-alpine
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /site
|
||||
@ -49,7 +53,7 @@ EXPOSE 80
|
||||
|
||||
# Healthcheck to ensure the server is running
|
||||
HEALTHCHECK --interval=30s --timeout=3s \
|
||||
CMD curl -f http://localhost:80/ || exit 1
|
||||
CMD wget -qO- 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