diff --git a/Dockerfile b/Dockerfile index 2f371f5b..7e4e2e90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM python:2.7-slim +FROM python:3.12.3-slim + +ARG PUBLISH_DRAFT='' COPY . ./ @@ -7,4 +9,6 @@ RUN apt-get update && \ RUN pip install -r requirements.txt +RUN test -n ${PUBLISH_DRAFT} && ./draft/publish.sh ${PUBLISH_DRAFT} + CMD ["bash", "-c", "make serve LANG=en"] \ No newline at end of file diff --git a/Makefile b/Makefile index 5e6ac32a..76fc5984 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ html: ./generate-html.py $(LANG) resources: - cp -r resources output/$(LANG)/ + cp -r resources phatstack output/$(LANG)/ devel: css all resources ./serve.py ${LANG} diff --git a/README.md b/README.md index 36cc43a4..d5d5a238 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,12 @@ docker run -p 5000:5000 -e PINOUT_LANG=en pinout.xyz Now you can access the webserver at http://127.0.0.1:5000. +Optionally you can include a draft board in the containerized webserver by setting the `PUBLISH_DRAFT` build argument: + +```bash +docker run -p 5000:5000 -e PINOUT_LANG=en --build-arg PUBLISH_DRAFT=myboard pinout.xyz +``` + # Translating If you would like to provide support for a language not yet in the repository you should start by duplicating the `src/en` directory to the appropriate [language-code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). For example, if you want to create a Czech translation you would create the folder `src/cs`. Note that there are no plans to support cultures (it would just get out of hand), so you can't have `src/fr-CA` (sorry!). diff --git a/draft/boards/spotpear-raspberry-pi-game.png b/draft/boards/spotpear-raspberry-pi-game.png new file mode 100644 index 00000000..16fc9b40 Binary files /dev/null and b/draft/boards/spotpear-raspberry-pi-game.png differ diff --git a/draft/overlay/spotpear-raspberry-pi-game.md b/draft/overlay/spotpear-raspberry-pi-game.md new file mode 100644 index 00000000..c9578946 --- /dev/null +++ b/draft/overlay/spotpear-raspberry-pi-game.md @@ -0,0 +1,78 @@ + +# Raspberry Pi Game + +1.3" LCD with inbuilt 3 watt speaker, headphone out and game controller buttons (Start, Select, D-pad, A, B, X, Y and L/R trigger buttons) + +## Features + +* 240x240 LCD (ST7789V driver) +* 3W speaker +* 3.5mm headphone output +* 12 game controller buttons \ No newline at end of file diff --git a/serve.py b/serve.py index a925d3af..233f5377 100755 --- a/serve.py +++ b/serve.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import sys +import os try: from flask import Flask, send_from_directory @@ -25,6 +26,9 @@ def custom_static(filename): @app.route("/") def show_page(page): + if not os.path.exists('{}/{}.html'.format(basedir, page)): + page = page + '/index' + return send_from_directory(basedir, '{}.html'.format(page))