-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (19 loc) · 895 Bytes
/
Dockerfile
File metadata and controls
27 lines (19 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM python:3.12-slim AS base
LABEL maintainer="ksanyok@me.com"
LABEL org.opencontainers.image.title="TextHumanize"
LABEL org.opencontainers.image.description="Advanced text naturalization engine"
LABEL org.opencontainers.image.source="https://github.com/ksanyok/TextHumanize"
WORKDIR /app
# Copy only what's needed (no tests, no docs, no PHP/JS)
COPY pyproject.toml .
COPY texthumanize/ texthumanize/
RUN pip install --no-cache-dir -e . && \
python -c "import texthumanize; print(f'TextHumanize {texthumanize.__version__} ready')"
# Non-root user for security
RUN useradd -m -r appuser && chown -R appuser:appuser /app
USER appuser
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')" || exit 1
ENTRYPOINT ["python", "-m", "texthumanize"]
CMD ["--api", "--port", "8080"]