Files
inbraille/Dockerfile
T
Lucas RayanandClaude Sonnet 5.5 a9aec5abe4
Release / Plano (reaproveitar a imagem?) (push) Successful in 8s
CI / Trivy (dependências, segredos e configuração) (push) Failing after 8s
Release / ci (push) Failing after 9s
CI / Testes e imagem Docker (linux/arm64) (push) Skipped
Release / Publica a imagem (linux/arm64) (push) Skipped
Release / Cria a release no Gitea (push) Skipped
Recover InBraille from the production image (1.3.1) and move it to Gitea
The GitHub account was suspended and the repository had no backup. The deployed code
(src/, public/, index.html, main.py, requirements.txt) was extracted from the production
image 1.3.1. The tests, Dockerfile, compose files, SECURITY.md, CHANGELOG.md and README were
rebuilt from the records of the work sessions that created them; LICENSE, .gitignore,
robots.txt and sitemap.xml were recreated. CI now runs on Gitea Actions.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 00:15:01 -03:00

68 lines
2.4 KiB
Docker

# syntax=docker/dockerfile:1
# ── base: Python and the runtime libraries VTK needs (shared by test and runtime) ──
FROM python:3.14-slim-trixie AS base
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PORT=3000 \
# The container is only reachable through the reverse proxy, so trust its X-Forwarded-For
# (needed for per-client rate limiting).
FORWARDED_ALLOW_IPS="*"
WORKDIR /app
# Runtime libraries required by VTK.
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libosmesa6 \
&& rm -rf /var/lib/apt/lists/*
# ── test: `docker build --target test .` runs the pytest suite (used by CI) ──
FROM base AS test
COPY requirements.txt requirements-dev.txt pytest.ini ./
# --prefer-binary: never compile from source (required on ARM64 where some wheels are missing)
RUN pip install --prefer-binary -r requirements-dev.txt
COPY main.py index.html google21a790a2c23c0ec5.html robots.txt sitemap.xml ./
COPY src ./src
COPY public ./public
COPY tests ./tests
RUN python -m pytest -q
# ── runtime: the image that ships ──
FROM base AS runtime
ARG VERSION=dev
ARG REVISION=unknown
LABEL org.opencontainers.image.title="InBraille" \
org.opencontainers.image.description="Text to Braille converter with STL export for 3D printing" \
org.opencontainers.image.source="https://git.lucasrguerra.dev.br/lucasrguerra/inbraille" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.revision="${REVISION}"
COPY requirements.txt .
# pip/setuptools (and the libraries vendored inside pip) are build tools: remove them from the runtime image.
RUN pip install --prefer-binary -r requirements.txt \
&& pip uninstall -y pip setuptools wheel
COPY main.py index.html google21a790a2c23c0ec5.html robots.txt sitemap.xml ./
COPY src ./src
COPY public ./public
RUN useradd --system --uid 10001 --no-create-home --shell /usr/sbin/nologin inbraille
USER 10001
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
CMD ["python", "-c", "import os,urllib.request as u; u.urlopen('http://127.0.0.1:%s/' % os.environ.get('PORT','3000'), timeout=5)"]
CMD ["python", "main.py"]