-
-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathDockerfile
30 lines (27 loc) · 1.18 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
# syntax=docker/dockerfile:1.3-labs
FROM python:3.12-slim-bookworm AS compile-image
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt update && \
apt install -y build-essential && \
python -m venv --without-pip --system-site-packages /opt/dipdup && \
mkdir -p /opt/dipdup/src/dipdup/ && \
touch /opt/dipdup/src/dipdup/__init__.py && \
rm -r /var/log/* /var/lib/apt/lists/* /var/cache/* /var/lib/dpkg/status*
WORKDIR /opt/dipdup
ENV PATH="/root/.cargo/bin:/opt/dipdup/.venv/bin:$PATH"
COPY pyproject.toml requirements.txt README.md /opt/dipdup/
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
RUN uv pip install --prefix /opt/dipdup --compile-bytecode --no-cache --no-deps \
-r /opt/dipdup/requirements.txt -e .
FROM python:3.12-slim-bookworm AS build-image
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN useradd -ms /bin/bash dipdup
USER dipdup
ENV DIPDUP_DOCKER=1
ENV PATH="/opt/dipdup/bin:$PATH"
ENV PYTHONPATH="/home/dipdup:/home/dipdup/src:/opt/dipdup/src:/opt/dipdup/lib/python3.12/site-packages:$PYTHONPATH"
WORKDIR /home/dipdup/
ENTRYPOINT ["dipdup"]
CMD ["run"]
COPY --chown=dipdup --from=compile-image /opt/dipdup /opt/dipdup
COPY --chown=dipdup . /opt/dipdup