Skip to content
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ venv
.cache
.yarn
public
node_modules
node_modules
.docker.buildhash
29 changes: 29 additions & 0 deletions docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Targets macOS and Linux. Run with: ./docker.sh or bash docker.sh

set -euo pipefail
if [ -z "${BASH_VERSINFO+x}" ]; then
echo "This script requires bash. Run with: bash $0" >&2
exit 1
fi
trap 'echo "Error: $0 failed at line $LINENO. Command: $BASH_COMMAND" >&2; exit 1' ERR

IMAGE=age-doc
HASH_FILE=".docker.buildhash"

if command -v sha256sum >/dev/null 2>&1; then
HASH_CMD="sha256sum"
else
HASH_CMD="shasum -a 256"
fi

NEW_HASH=$(
$HASH_CMD docker/Dockerfile requirements.txt | $HASH_CMD | awk '{print $1}'
)

if [ ! -f "$HASH_FILE" ] || [ "$NEW_HASH" != "$(cat "$HASH_FILE")" ]; then
docker build -f docker/Dockerfile -t "$IMAGE" .
echo "$NEW_HASH" > "$HASH_FILE"
fi

docker run --rm -v "$PWD":/app -w /app "$IMAGE" sphinx-multiversion docs build/html
11 changes: 11 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.11-slim

RUN apt-get update \
&& apt-get install -y --no-install-recommends git texlive-latex-base dvisvgm \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app
VOLUME ["/app"]

COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pydantic==1.10.13
Pygments==2.15.0
pyparsing==3.0.9
pytz==2022.4
PyYAML==6.0
PyYAML==6.0.3
requests==2.32.0
rich==12.6.0
rstcheck==6.1.0
Expand Down