forked from dipdup-io/dipdup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.slim
28 lines (24 loc) · 1.22 KB
/
Dockerfile.slim
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
FROM python:3.10-alpine3.16 AS compile-image
RUN apk add --update --no-cache build-base gcc musl-dev python3-dev libffi-dev openssl-dev cargo && \
python -m venv --without-pip --system-site-packages /opt/dipdup && \
mkdir -p /opt/dipdup/src/dipdup/ && \
touch /opt/dipdup/src/dipdup/__init__.py
WORKDIR /opt/dipdup
ENV PATH="/opt/dipdup/bin:$PATH"
ENV PYTHON_PATH="/opt/dipdup/src:$PATH"
COPY pyproject.toml requirements.slim.txt README.md /opt/dipdup/
RUN /usr/local/bin/pip install --prefix /opt/dipdup --no-cache-dir --disable-pip-version-check --no-deps -r /opt/dipdup/requirements.slim.txt -e .
FROM python:3.10-alpine3.16 AS build-image
RUN adduser -D dipdup
USER dipdup
ENV DIPDUP_DOCKER=1
ENV DIPDUP_DOCKER_IMAGE=slim
ENV PATH="/opt/dipdup/bin:$PATH"
ENV PYTHONPATH="/home/dipdup:/home/dipdup/src:/opt/dipdup/src:/opt/dipdup/lib/python3.10/site-packages:$PYTHONPATH"
WORKDIR /home/dipdup/
ENTRYPOINT ["dipdup"]
CMD ["run"]
COPY --chown=dipdup --chmod=0755 scripts/install_dependencies.sh /opt/dipdup/bin/install_dependencies
COPY --chown=dipdup --chmod=0755 scripts/install_dependencies.sh /opt/dipdup/bin/inject_pyproject
COPY --chown=dipdup --from=compile-image /opt/dipdup /opt/dipdup
COPY --chown=dipdup . /opt/dipdup