From 0dbb38aa6f8962360578b4aa5f31524497d6174d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katariina=20J=C3=A4rvenm=C3=A4ki?= Date: Sun, 29 Mar 2026 13:18:00 +0300 Subject: [PATCH 1/2] Add working Dockerfile and fix plan to reflect Tampio's Python roots --- Dockerfile | 25 +++++++++++++++++++++++++ PLAN.md | 12 +++++++----- docker-compose.yml | 8 ++++++++ 3 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8a9cd99 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:24.04 + +# Avoid interactive prompts during apt installs +ENV DEBIAN_FRONTEND=noninteractive + +# libvoikko: the Finnish morphology library Tampio depends on +# voikko-fi: the actual Finnish dictionary data +RUN apt-get update && apt-get install -y \ + libvoikko-dev \ + voikko-fi \ + python3 \ + python3-libvoikko \ + git \ + && rm -rf /var/lib/apt/lists/* + +# Install Tampio directly from source (not on PyPI or npm) +RUN git clone https://github.com/fergusq/tampio.git /opt/tampio + +# Handy wrapper so you can just call `tampio` from anywhere +RUN echo '#!/bin/sh\npython3 /opt/tampio/tampio.py "$@"' > /usr/local/bin/tampio \ + && chmod +x /usr/local/bin/tampio + +WORKDIR /tampiorama + +CMD ["/bin/bash"] diff --git a/PLAN.md b/PLAN.md index 310710b..caa85e5 100644 --- a/PLAN.md +++ b/PLAN.md @@ -1,6 +1,6 @@ # Tampiorama — Project Plan -This is a project plan for project that's meaning is to be open source showcase for Tampio, the Finnish natural-language OOP language that compiles to JavaScript. +This is a project plan for open source showcase for Tampio, the Finnish natural-language OOP language. Tampio is a Python-based compiler that takes Finnish-syntax source files and compiles them to JavaScript. ## Project Goals @@ -23,15 +23,17 @@ tampiorama/ ├── basics/ ← factorial, fibonacci, hello world ├── data-structures/ ← lists, maps ├── strings/ - ├── async/ ← Promise/async usage + ├── async/ ← async/Promise in the compiled JS output └── program/ ← small "real" program ``` ## Docker -- Base image: Debian or Ubuntu (libvoikko available via apt) -- Installs: `libvoikko-dev`, Node.js, `tampio` (npm) -- Goal: `docker run` gives a working Tampio environment with no manual setup +- Base image: Ubuntu 24.04 +- Installs: `libvoikko-dev`, `voikko-fi`, Python 3, `python3-libvoikko`, clones tampio from GitHub +- Note: Tampio is not on PyPI or npm — installed directly from source +- A `/usr/local/bin/tampio` wrapper makes it callable as a plain command +- Goal: `docker compose run --rm tampio` gives a working shell with no manual setup ## Open Questions diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4343738 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + tampio: + build: . + volumes: + - .:/tampiorama + working_dir: /tampiorama + stdin_open: true + tty: true From 935e016c401defb0ec37a5cd70d463672df8fe30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katariina=20J=C3=A4rvenm=C3=A4ki?= Date: Sun, 29 Mar 2026 13:34:44 +0300 Subject: [PATCH 2/2] Ignore Tampio output and add fi-x-morpho dictionary to Docker --- .gitignore | 6 ++++++ Dockerfile | 15 ++++++++++++++- Makefile | 22 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 29115ae..ab6cc1e 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,9 @@ npm-debug.log* # Mac and Windows breadcrumbs .DS_Store Thumbs.db + +# Compiled Tampio output — generated from .itp source files via `make` +examples/**/*.html + +# Hiding temp files +diff.txt \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8a9cd99..88b7686 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,15 +4,28 @@ FROM ubuntu:24.04 ENV DEBIAN_FRONTEND=noninteractive # libvoikko: the Finnish morphology library Tampio depends on -# voikko-fi: the actual Finnish dictionary data +# voikko-fi: provides only mor-standard; fi-x-morpho must be downloaded separately RUN apt-get update && apt-get install -y \ libvoikko-dev \ voikko-fi \ python3 \ python3-libvoikko \ git \ + curl \ + unzip \ && rm -rf /var/lib/apt/lists/* +# Install the fi-x-morpho dictionary that Tampio requires. +# The voikko-fi apt package only ships mor-standard; the morpho variant is a +# separate snapshot published by the voikko-fi project. The zip unpacks to +# 5/mor-morpho/ which is exactly where libvoikko looks for it under a search +# path. We install it system-wide under /usr/lib/voikko so it is available to +# all users (including non-interactive Docker runs). +RUN curl -fsSL https://www.puimula.org/htp/testing/voikko-snapshot-v5/dict-morpho.zip \ + -o /tmp/dict-morpho.zip \ + && unzip /tmp/dict-morpho.zip -d /usr/lib/voikko \ + && rm /tmp/dict-morpho.zip + # Install Tampio directly from source (not on PyPI or npm) RUN git clone https://github.com/fergusq/tampio.git /opt/tampio diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..21e931f --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +TAMPIO = docker compose run --rm tampio tampio -i -p + +EXAMPLES = \ + examples/basics/hello.html \ + examples/basics/factorial.html \ + examples/basics/fibonacci.html \ + examples/basics/index.html \ + examples/data-structures/lista.html \ + examples/data-structures/vektori.html \ + examples/strings/merkkijono.html \ + examples/async/nappi.html \ + examples/program/kasvutaulukko.html + +.PHONY: all clean + +all: $(EXAMPLES) + +%.html: %.itp + $(TAMPIO) $< 2>/dev/null > $@ + +clean: + rm -f $(EXAMPLES)