Files
ha-sip-notifier/sip-notifier/Dockerfile

76 lines
1.6 KiB
Docker

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 runtime dependencies only
RUN apk add --no-cache \
python3 \
py3-pip \
ffmpeg \
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 --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
CMD [ "/app/run.sh" ]