ffd
This commit is contained in:
58
Dockerfile
58
Dockerfile
@ -1,27 +1,32 @@
|
|||||||
# Build stage
|
# Build stage
|
||||||
FROM python:3.9-alpine AS builder
|
FROM ubuntu:20.04 AS builder
|
||||||
|
|
||||||
# Set environment variables
|
# Set environment variables to avoid interactive prompts
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1
|
PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# Configure apk to use a reliable mirror
|
# Configure apt to use reliable mirrors
|
||||||
RUN echo "https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.18/main" > /etc/apk/repositories && \
|
RUN echo "deb http://archive.ubuntu.com/ubuntu focal main restricted universe" > /etc/apt/sources.list && \
|
||||||
echo "https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.18/community" >> /etc/apk/repositories
|
echo "deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe" >> /etc/apt/sources.list && \
|
||||||
|
echo "deb http://archive.ubuntu.com/ubuntu focal-security main restricted universe" >> /etc/apt/sources.list && \
|
||||||
|
echo "deb http://us.archive.ubuntu.com/ubuntu focal main restricted universe" >> /etc/apt/sources.list
|
||||||
|
|
||||||
# Install build dependencies
|
# Install Python 3.9 and build dependencies
|
||||||
RUN apk add --no-cache \
|
RUN apt-get update -o Acquire::Retries=10 -o Acquire::http::Timeout=30 && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
python3.9 \
|
||||||
|
python3.9-dev \
|
||||||
|
python3-pip \
|
||||||
gcc \
|
gcc \
|
||||||
musl-dev \
|
g++ \
|
||||||
python3-dev \
|
make && \
|
||||||
libffi-dev \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
openssl-dev \
|
ln -sf /usr/bin/python3.9 /usr/bin/python3
|
||||||
make \
|
|
||||||
linux-headers \
|
|
||||||
glibc # Add glibc compatibility layer for missing symbols
|
|
||||||
|
|
||||||
# Install MkDocs and plugins with exact versions
|
# Upgrade pip and install MkDocs and plugins
|
||||||
RUN pip install --no-cache-dir \
|
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
|
||||||
|
pip install --no-cache-dir \
|
||||||
mkdocs==1.6.1 \
|
mkdocs==1.6.1 \
|
||||||
mkdocs-material==9.5.39 \
|
mkdocs-material==9.5.39 \
|
||||||
mkdocs-macros-plugin==1.2.0 \
|
mkdocs-macros-plugin==1.2.0 \
|
||||||
@ -40,7 +45,20 @@ COPY docs/ ./docs/
|
|||||||
RUN mkdocs build --strict
|
RUN mkdocs build --strict
|
||||||
|
|
||||||
# Runtime stage
|
# Runtime stage
|
||||||
FROM python:3.9-alpine
|
FROM ubuntu:20.04
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
# Install Python 3.9 minimal for runtime
|
||||||
|
RUN apt-get update -o Acquire::Retries=10 -o Acquire::http::Timeout=30 && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
python3.9 \
|
||||||
|
curl && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
ln -sf /usr/bin/python3.9 /usr/bin/python3
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /site
|
WORKDIR /site
|
||||||
@ -53,7 +71,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 ["python3", "-m", "http.server", "80"]
|
||||||
Reference in New Issue
Block a user