From ebaad620c94ee8c39a30de0cc5ebde1cef6e1169 Mon Sep 17 00:00:00 2001 From: gugulethu Date: Fri, 20 Jun 2025 16:43:30 +0200 Subject: [PATCH] Update Dockerfile --- Dockerfile | 64 +++++++++++------------------------------------------- 1 file changed, 13 insertions(+), 51 deletions(-) diff --git a/Dockerfile b/Dockerfile index e0e6664..1188d31 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,58 +1,20 @@ -# ------------------------------------------------------------- -# Stage 1: Build the MkDocs site -# ------------------------------------------------------------- -FROM python:3.11-slim AS builder - -# 1) Install build prerequisites -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - gcc git rsync \ - && rm -rf /var/lib/apt/lists/* +# Use the official Python image as a base +FROM python:3.11-slim +# Set the working directory in the container WORKDIR /app -# 2) Copy and install dependencies (including mkdocs) -COPY requirements.txt mkdocs.yml ./ -RUN pip install --no-cache-dir -r requirements.txt mkdocs +# Copy the requirements file if you have one +COPY requirements.txt . -# 3) Copy your docs source -COPY docs/ ./docs -# If you have extra markdown or assets outside docs/, add more COPY lines here +# Install MkDocs and any other dependencies +RUN pip install --no-cache-dir -r requirements.txt -# 4) Build the static site into /app/site -RUN mkdocs build --clean --site-dir site +# Copy the entire MkDocs project into the container +COPY . . +# Expose the port that MkDocs will run on +EXPOSE 80 -# ------------------------------------------------------------- -# Stage 2: Deployer -# ------------------------------------------------------------- -FROM alpine:3.18 AS deployer - -# we need rsync in this stage -RUN apk add --no-cache rsync - -WORKDIR /app - -# Bring the built site in -COPY --from=builder /app/site ./site - -# container will expect you to bind-mount your local nginx docroot into /deploy -VOLUME ["/deploy"] - -COPY --chmod=+x << 'EOF' /usr/local/bin/deploy.sh -#!/bin/sh -set -e - -SRC="/app/site/" -DST="/deploy/" - -echo "Deploying site from $SRC to $DST …" - -# simple sync, deletes stale files on DEST -rsync -av --delete "$SRC" "$DST" - -echo "✅ Deployment complete." -EOF - -ENTRYPOINT ["/usr/local/bin/deploy.sh"] -CMD [""] # no-op; all logic in entrypoint +# Command to run MkDocs +CMD ["mkdocs", "build"] \ No newline at end of file