-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathDockerfile
More file actions
77 lines (58 loc) · 2.3 KB
/
Dockerfile
File metadata and controls
77 lines (58 loc) · 2.3 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
75
76
77
FROM debian:trixie-slim AS base
ENV UV_PYTHON_VERSION=3.14.2 \
TINI_VERSION=v0.19.0 \
UV_COMPILE_BYTECODE=1 \
# Copy from the cache instead of linking since it's a mounted volume
UV_LINK_MODE=copy \
UV_PYTHON_INSTALL_DIR=/python \
UV_PYTHON_PREFERENCE=only-managed
COPY --from=ghcr.io/astral-sh/uv:0.10.4 /uv /uvx /bin/
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
gettext \
docutils-common \
curl \
wget \
git \
&& dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
&& wget "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${dpkgArch}" -O /usr/local/bin/tini \
&& chmod +x /usr/local/bin/tini && tini --version \
&& uv python install $UV_PYTHON_VERSION \
&& apt-get clean \
&& apt-get autoclean
# Install the project's dependencies using the lockfile and settings
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-install-project --no-dev
# Place executables in the virtual environment at the front of the path
ENV PATH="/.venv/bin:$PATH"
# Create folders for running Jandig without Gunicorn or MinIO
RUN mkdir -p /jandig/static /jandig/build
WORKDIR /jandig
COPY ./run.sh /jandig/run.sh
COPY ./docs/ /jandig/docs/
COPY ./locale/ /jandig/locale/
COPY ./pyproject.toml /jandig/pyproject.toml
COPY ./uv.lock /jandig/uv.lock
COPY ./src/ /jandig/src/
ENTRYPOINT ["tini", "--"]
CMD [ "/jandig/run.sh" ]
FROM base AS local_dev
ENV PATH="$PATH:/jandig/minio-binaries/"
# Install MinIO client
COPY --from=minio/mc:RELEASE.2025-04-16T18-13-26Z /usr/bin/mc /jandig/minio-binaries/mc
COPY ./collection/ /jandig/collection/
COPY ./etc/create_buckets.sh /jandig/create_buckets.sh
WORKDIR /
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync
RUN uv run playwright install chromium --with-deps
RUN groupadd -g 1000 jandig && useradd -u 1000 -g 1000 -r -m -d /home/jandig jandig
RUN chown -R jandig:jandig /jandig
USER jandig
WORKDIR /jandig
CMD ["/bin/bash", "-c", "/jandig/etc/create_buckets.sh && /jandig/run.sh"]