Skip to content

Commit 1d39ae3

Browse files
committed
WIP
1 parent d6df8df commit 1d39ae3

File tree

2 files changed

+70
-20
lines changed

2 files changed

+70
-20
lines changed

Dockerfile

Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,76 @@
1-
FROM python:3.11-alpine
1+
# == Builder Stage: Install dependencies with build tools ==
2+
FROM python:3.12-alpine AS builder
23

3-
ENV PYTHONDONTWRITEBYTECODE 1
4-
ENV PYTHONUNBUFFERED 1
4+
ENV PYTHONDONTWRITEBYTECODE=1 \
5+
PYTHONUNBUFFERED=1 \
6+
PIP_NO_CACHE_DIR=1 \
7+
PIP_DISABLE_PIP_VERSION_CHECK=1
58

6-
# Set build directory
7-
WORKDIR /tmp
9+
WORKDIR /build
810

9-
# Install pip requirements
10-
ADD requirements*.txt ./
11+
# Install build dependencies
12+
RUN apk add --no-cache \
13+
gcc \
14+
musl-dev \
15+
libffi-dev \
16+
openssl-dev \
17+
cairo-dev \
18+
pango-dev \
19+
gdk-pixbuf-dev
1120

12-
# Perform build and cleanup artifacts
13-
RUN \
14-
apk add --no-cache \
21+
# Copy and install Python dependencies
22+
COPY requirements.txt ./
23+
RUN python -m venv /opt/venv \
24+
&& /opt/venv/bin/pip install --upgrade pip \
25+
&& /opt/venv/bin/pip install -r requirements.txt
26+
27+
28+
# == Runtime Stage: Minimal image for development ==
29+
30+
FROM python:3.12-alpine
31+
32+
LABEL org.opencontainers.image.title="Geotribu Website Stack" \
33+
org.opencontainers.image.description="Technical stack to build Geotribu website." \
34+
org.opencontainers.image.source="https://github.com/geotribu/website/" \
35+
org.opencontainers.image.licenses="GPL-3.0-or-later"
36+
37+
ENV PYTHONDONTWRITEBYTECODE=1 \
38+
PYTHONUNBUFFERED=1 \
39+
PYTHONOPTIMIZE=2 \
40+
LANG=fr_FR.UTF-8 \
41+
LANGUAGE=fr_FR:fr \
42+
LC_ALL=fr_FR.UTF-8 \
43+
PATH="/opt/venv/bin:$PATH"
44+
45+
# Install runtime dependencies including French locale support
46+
RUN apk add --no-cache \
1547
git \
1648
git-fast-import \
17-
openssh \
18-
&& apk add --no-cache --virtual .build gcc musl-dev \
19-
&& pip install --no-cache-dir -r requirements-free.txt \
20-
&& apk del .build gcc musl-dev \
21-
&& rm -rf /tmp/*
49+
openssh-client \
50+
libffi \
51+
musl-locales \
52+
musl-locales-lang \
53+
cairo \
54+
pango \
55+
gdk-pixbuf \
56+
&& echo "export LANG=fr_FR.UTF-8" > /etc/profile.d/locale.sh
2257

23-
# Set working directory
2458
WORKDIR /app
59+
60+
# Copy virtual environment from builder
61+
COPY --from=builder /opt/venv /opt/venv
62+
63+
# Copy application files for initial setup
64+
COPY config/ ./config/
65+
COPY hooks/ ./hooks/
66+
COPY mkdocs.yml ./
67+
COPY scripts/ ./scripts/
68+
69+
# Generate CLI help and merge config
70+
RUN mkdir -p content/toc_nav_ignored/snippets/code \
71+
&& geotribu --help > content/toc_nav_ignored/snippets/code/geotribu_cli_help.txt \
72+
&& python scripts/100_mkdocs_config_merger.py -c mkdocs.yml
73+
74+
EXPOSE 8000
75+
76+
CMD ["mkdocs", "serve", "--dev-addr=0.0.0.0:8000"]

docker-compose-mkdocs.dev.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.7'
2-
31
services:
42
website:
53
container_name: geotribu-mkdocs-site
@@ -12,5 +10,5 @@ services:
1210
ports:
1311
- 8000:8000
1412
volumes:
15-
- .:/app
16-
command: mkdocs serve --config-file mkdocs-minimal.yml --dirtyreload --dev-addr=0.0.0.0:8000
13+
- ./content/:/app
14+
command: mkdocs serve --dirtyreload --dev-addr=0.0.0.0:8000

0 commit comments

Comments
 (0)