ARG version=3.9
ARG tag=${version}-alpine3.17
FROM python:${tag} as builder
WORKDIR /app
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
RUN apk add --update \
cargo \
git \
gcc \
g++ \
jpeg-dev \
libc-dev \
linux-headers \
musl-dev \
patchelf \
rust \
zlib-dev
RUN pip install -U pip wheel setuptools maturin
COPY requirements.txt .
RUN pip install -r requirements.txt --no-build-isolation
FROM python:${tag}
ARG version
COPY --from=builder \
/usr/local/lib/python${version}/site-packages \
/usr/local/lib/python${version}/site-packages
RUN apk add --update netcat-openbsd libusb-dev
COPY . .
RUN pip install . --no-cache-dir
COPY ./docker/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["sh", "/entrypoint.sh"]
CMD ["unifi-cam-proxy"]