-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
74 lines (61 loc) · 2.91 KB
/
Copy pathDockerfile
File metadata and controls
74 lines (61 loc) · 2.91 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# syntax=docker/dockerfile:1.7
FROM python:3.12-slim
ARG BUILD_DATE="unknown"
ARG VERSION="dev"
ARG REVISION="unknown"
ARG VCS_URL="unknown"
ARG DOCUMENTATION_URL="unknown"
ARG LICENSES="Proprietary"
LABEL org.opencontainers.image.title="Bio2Byte RAGU" \
org.opencontainers.image.description="Local-first Streamlit RAG application for structural biology PDF question answering." \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.revision="${REVISION}" \
org.opencontainers.image.source="${VCS_URL}" \
org.opencontainers.image.documentation="${DOCUMENTATION_URL}" \
org.opencontainers.image.licenses="${LICENSES}" \
org.opencontainers.image.vendor="Bio2Byte"
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIPER_COMMAND=piper \
PIPER_MODEL_PATH=/app/piper/models/en_US-lessac-medium.onnx \
PIPER_CONFIG_PATH=/app/piper/models/en_US-lessac-medium.onnx.json \
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
STREAMLIT_SERVER_FILE_WATCHER_TYPE=none \
STREAMLIT_SERVER_HEADLESS=true \
STREAMLIT_SERVER_PORT=8501
RUN apt-get update \
&& apt-get install --yes --no-install-recommends build-essential curl ca-certificates libatomic1 libespeak-ng1 libstdc++6 \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --system raguser \
&& useradd --system --gid raguser --create-home --home-dir /home/raguser raguser
WORKDIR /tmp/pip
COPY requirements.txt .
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --upgrade pip \
&& pip install -r requirements.txt
RUN set -eux; \
arch="$(dpkg --print-architecture)"; \
mkdir -p /app/piper/models; \
if [ "$arch" = "amd64" ]; then \
curl -fsSL "https://github.com/rhasspy/piper/releases/download/2023.11.14-2/piper_linux_x86_64.tar.gz" -o /tmp/piper.tar.gz; \
elif [ "$arch" = "arm64" ]; then \
curl -fsSL "https://github.com/rhasspy/piper/releases/download/2023.11.14-2/piper_linux_aarch64.tar.gz" -o /tmp/piper.tar.gz; \
else \
echo "Skipping Piper install on unsupported architecture: $arch"; \
exit 0; \
fi; \
tar -xzf /tmp/piper.tar.gz -C /app/piper --strip-components=1; \
rm /tmp/piper.tar.gz; \
ln -sf /app/piper/piper /usr/local/bin/piper; \
curl -fsSL "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx?download=true" -o /app/piper/models/en_US-lessac-medium.onnx; \
curl -fsSL "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx.json?download=true" -o /app/piper/models/en_US-lessac-medium.onnx.json
WORKDIR /app
COPY --chown=raguser:raguser public .
COPY --chown=raguser:raguser app.py app.py
RUN mkdir -p /app/ragu-data \
&& chown -R raguser:raguser /app
USER raguser
EXPOSE 8501
CMD ["streamlit", "run", "/app/app.py"]