BroadbandForum / obuspa

OB-USP-AGENT is a system daemon providing a User Services Platform (USP) Agent. https://github.com/BroadbandForum/obuspa/wiki
BSD 3-Clause "New" or "Revised" License
85 stars 59 forks source link

Dockerfile dependencies outdated #108

Open pyromiko opened 1 month ago

pyromiko commented 1 month ago

Seems that docker build is outdated.

i had to change Dockerfile to:

# Etapa de construcción (build-env)
FROM ubuntu:kinetic AS build-env

# Actualizar repositorios a old-releases
RUN sed -i 's|http://archive.ubuntu.com/ubuntu|http://old-releases.ubuntu.com/ubuntu|g' /etc/apt/sources.list && \
    sed -i 's|http://security.ubuntu.com/ubuntu|http://old-releases.ubuntu.com/ubuntu|g' /etc/apt/sources.list && \
    apt-get update && apt-get -y install \
    libssl-dev \
    libcurl4-openssl-dev \
    libsqlite3-dev \
    libz-dev \
    autoconf \
    automake \
    libtool \
    pkg-config \
    make \
    git \
    cmake \
    g++ \
    libmosquitto-dev \
    && apt-get clean

# Instalar la última versión de libwebsockets
RUN git clone https://github.com/warmcat/libwebsockets.git /tmp/libwebsockets && \
    cd /tmp/libwebsockets && \
    mkdir build && \
    cd build && \
    cmake .. && \
    make && \
    make install && \
    ldconfig

# Etapa de ejecución (runner)
FROM build-env AS runner

ENV MAKE_JOBS=8
ENV OBUSPA_ARGS="-v4"

# Copiar el código fuente y compilar obuspa
COPY . /obuspa/
RUN cd /obuspa/ && \
    autoreconf -fi && \
    ./configure CFLAGS="-Wno-error" && \
    make -j${MAKE_JOBS} && \
    make install

# Limpiar el código fuente
RUN rm -rf /obuspa

# Ejecutar obuspa con los argumentos definidos
CMD obuspa ${OBUSPA_ARGS}
matiasba commented 1 month ago

I'm currently using this docker file that i pull from #96 It uses an up to date ubuntu version.

FROM ubuntu:22.04 AS build-env

# Install dependencies
RUN apt update && apt -y install \
        build-essential \
        libssl-dev \
        libcurl4-openssl-dev\
        libsqlite3-dev \
        libz-dev \
        autoconf \
        automake \
        libtool \
        libmosquitto-dev \
        pkg-config \
        git \
        cmake \
        make \
    && apt clean

RUN mkdir -p /usr/local/src
WORKDIR /usr/local/src/
RUN git clone https://github.com/warmcat/libwebsockets.git libwebsockets
WORKDIR /usr/local/src/libwebsockets
RUN cmake -B build -S .
RUN cd build && make && make install
# install libs in /usr/local/lib ; configured in /etc/ld.so.conf.d/libc.conf
# ENV LD_LIBRARY_PATH /usr/local/lib:${LD_LIBRARY_PATH}
RUN ldconfig -v

ENV MAKE_JOBS=8

COPY . /obuspa/
RUN cd /obuspa/ && \
    autoreconf -fi && \
    ./configure && \
    make -j${MAKE_JOBS} && \
    make install

FROM debian:stable AS build-release-stage
RUN apt update && apt -y install \
    libssl-dev \
    libsqlite3-dev \
    libcurl4-openssl-dev\
    libmosquitto-dev

WORKDIR /
COPY --from=build-env /usr/local/lib/libwebsockets.* /usr/local/lib
COPY --from=build-env /obuspa/obuspa /bin
COPY --from=build-env /obuspa/factory_reset_example.txt /etc
RUN ldconfig -v

ENV OBUSPA_ARGS="-p -v 4 -r /etc/factory_reset_example.txt --dbfile /tmp/sqldb"

# Run obuspa with args expanded
CMD obuspa ${OBUSPA_ARGS}