Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// "image": "mcr.microsoft.com/devcontainers/python:0-3.11",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers-contrib/features/apt-packages:1": {
"ghcr.io/devcontainers-extra/features/apt-packages:1": {
"packages": [
"libcairo2-dev",
"libfreetype6-dev",
Expand All @@ -20,7 +20,7 @@
"pngquant"
]
},
"ghcr.io/devcontainers-contrib/features/coverage-py:2": {}
"ghcr.io/devcontainers-extra/features/coverage-py:2": {}
},
// Configure tool-specific properties.
"customizations": {
Expand Down Expand Up @@ -80,7 +80,7 @@
"tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format",
"tag:yaml.org,2002:python/name:material.plugins.tags.casefold",
"tag:yaml.org,2002:python/name:material.plugins.tags.page_url"
],
]
},
"extensions": [
"bierner.markdown-mermaid",
Expand Down
84 changes: 68 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,76 @@
FROM python:3.11-alpine
# == Builder Stage: Install dependencies with build tools ==
FROM python:3.12-alpine AS builder

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1

# Set build directory
WORKDIR /tmp
WORKDIR /build

# Install pip requirements
ADD requirements*.txt ./
# Install build dependencies
RUN apk add --no-cache \
gcc \
musl-dev \
libffi-dev \
openssl-dev \
cairo-dev \
pango-dev \
gdk-pixbuf-dev

# Perform build and cleanup artifacts
RUN \
apk add --no-cache \
# Copy and install Python dependencies
COPY requirements.txt ./
RUN python -m venv /opt/venv \
&& /opt/venv/bin/pip install --upgrade pip \
&& /opt/venv/bin/pip install -r requirements.txt


# == Runtime Stage: Minimal image for development ==

FROM python:3.12-alpine

LABEL org.opencontainers.image.title="Geotribu Website Stack" \
org.opencontainers.image.description="Technical stack to build Geotribu website." \
org.opencontainers.image.source="https://github.com/geotribu/website/" \
org.opencontainers.image.licenses="GPL-3.0-or-later"

ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONOPTIMIZE=2 \
LANG=fr_FR.UTF-8 \
LANGUAGE=fr_FR:fr \
LC_ALL=fr_FR.UTF-8 \
PATH="/opt/venv/bin:$PATH"

# Install runtime dependencies including French locale support
RUN apk add --no-cache \
git \
git-fast-import \
openssh \
&& apk add --no-cache --virtual .build gcc musl-dev \
&& pip install --no-cache-dir -r requirements-free.txt \
&& apk del .build gcc musl-dev \
&& rm -rf /tmp/*
openssh-client \
libffi \
musl-locales \
musl-locales-lang \
cairo \
pango \
gdk-pixbuf \
&& echo "export LANG=fr_FR.UTF-8" > /etc/profile.d/locale.sh

# Set working directory
WORKDIR /app

# Copy virtual environment from builder
COPY --from=builder /opt/venv /opt/venv

# Copy application files for initial setup
COPY config/ ./config/
COPY hooks/ ./hooks/
COPY mkdocs.yml ./
COPY scripts/ ./scripts/

# Generate CLI help and merge config
RUN mkdir -p content/toc_nav_ignored/snippets/code \
&& geotribu --help > content/toc_nav_ignored/snippets/code/geotribu_cli_help.txt \
&& python scripts/100_mkdocs_config_merger.py -c mkdocs.yml

EXPOSE 8000

CMD ["mkdocs", "serve", "--dev-addr=0.0.0.0:8000"]
6 changes: 2 additions & 4 deletions docker-compose-mkdocs.dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.7'

services:
website:
container_name: geotribu-mkdocs-site
Expand All @@ -12,5 +10,5 @@ services:
ports:
- 8000:8000
volumes:
- .:/app
command: mkdocs serve --config-file mkdocs-minimal.yml --dirtyreload --dev-addr=0.0.0.0:8000
- ./content/:/app
command: mkdocs serve --dirtyreload --dev-addr=0.0.0.0:8000