-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
38 lines (27 loc) · 1.03 KB
/
Dockerfile
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
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
ARG USER_ID=1000
WORKDIR /app
# Enable bytecode compilation
ENV UV_COMPILE_BYTECODE=1
# Copy from the cache instead of linking since it's a mounted volume
ENV UV_LINK_MODE=copy
# Create a non-root user without a group
RUN adduser --system --uid $USER_ID appuser
# Add poppler utils for pdftotext
RUN apt-get update && apt install -y sudo cgroup-tools poppler-utils && rm -rf /var/lib/apt/lists/*
# Copy uv related files for installation of venv
COPY uv.lock /app/uv.lock
COPY pyproject.toml /app/pyproject.toml
# Install the project's dependencies using the lockfile and settings
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-install-project --no-dev
# copy remaining files
COPY webserver.py /app/webserver.py
COPY run-me.sh /app/run-me.sh
# Switch to non-root user
# this is done in run-me.sh
# USER appuser
# Place executables in the environment at the front of the path
ENV PATH="/app/.venv/bin:$PATH"
# Run this when a container is started
CMD ["/app/run-me.sh"]