diff --git a/sip-notifier/Dockerfile b/sip-notifier/Dockerfile index 4bb57e3..35f0cce 100644 --- a/sip-notifier/Dockerfile +++ b/sip-notifier/Dockerfile @@ -1,24 +1,74 @@ ARG BUILD_FROM +FROM $BUILD_FROM as builder + +# Install build dependencies +RUN apk add --no-cache \ + git \ + build-base \ + python3-dev \ + linux-headers \ + openssl-dev \ + alsa-lib-dev \ + opus-dev \ + speex-dev \ + speexdsp-dev \ + py3-pip + +# Build PJSIP +WORKDIR /tmp +RUN git clone --depth 1 --branch 2.14.1 https://github.com/pjsip/pjproject.git && \ + cd pjproject && \ + ./configure \ + --prefix=/opt/pjsip \ + --enable-shared \ + --disable-video \ + --disable-opencore-amr \ + --disable-silk \ + --disable-opus \ + --disable-resample \ + --disable-speex-aec \ + --disable-g711-codec \ + --disable-l16-codec \ + --disable-g722-codec && \ + make dep && \ + make && \ + make install && \ + cd pjsip-apps/src/python && \ + python3 setup.py build && \ + python3 setup.py install --prefix=/opt/pjsip + +# Final stage FROM $BUILD_FROM -# Install system dependencies +# Install runtime dependencies only RUN apk add --no-cache \ python3 \ py3-pip \ - py3-pjsua2 \ ffmpeg \ - alsa-lib + alsa-lib \ + openssl \ + opus \ + speex \ + speexdsp + +# Copy PJSIP from builder +COPY --from=builder /opt/pjsip /usr/local +COPY --from=builder /usr/lib/python3.*/site-packages/pjsua2* /usr/lib/python3.11/site-packages/ + +# Update library cache +RUN ldconfig /usr/local/lib || true # Set working directory WORKDIR /app # Copy requirements and install Python dependencies COPY requirements.txt . -RUN pip3 install --no-cache-dir -r requirements.txt +RUN pip3 install --no-cache-dir --break-system-packages -r requirements.txt # Copy application files COPY run.sh . COPY sip_service.py . +COPY services.yaml . RUN chmod +x /app/run.sh