From cac26131867d7892d0e5ff02818288053be0401c Mon Sep 17 00:00:00 2001 From: Marco <66200214+marcob79@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:24:51 +0000 Subject: [PATCH] fixed envoy installation and optimized Dokcerfile --- src/Dockerfile | 63 ++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index bc6a0c7..77e2bd0 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,46 +1,33 @@ -from ubuntu:jammy - -# Install python -RUN apt update -RUN apt upgrade -y -RUN apt install curl software-properties-common apt-transport-https gnupg2 lsb-release vim -y -RUN add-apt-repository ppa:deadsnakes/ppa -y -RUN apt update -RUN DEBIAN_FRONTEND=noninteractive TZ=Europe/Rome apt install python3.12 -y -RUN apt install python-is-python3 -RUN ln -sf /usr/bin/python3.12 /usr/bin/python3 - -# Install pip -RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 - - -# Install envoy -RUN apt update -RUN curl -sL 'https://deb.dl.getenvoy.io/public/gpg.8115BA8E629CC074.key' | gpg --dearmor -o /usr/share/keyrings/getenvoy-keyring.gpg -RUN echo a077cb587a1b622e03aa4bf2f3689de14658a9497a9af2c427bba5f4cc3c4723 /usr/share/keyrings/getenvoy-keyring.gpg | sha256sum --check -RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/getenvoy-keyring.gpg] https://deb.dl.getenvoy.io/public/deb/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/getenvoy.list -RUN apt update -RUN apt install -y getenvoy-envoy - - +FROM ubuntu:jammy + +# Install dependencies, Python 3.12, and pip in one layer +RUN apt update && \ + apt upgrade -y && \ + apt install -y curl software-properties-common apt-transport-https gnupg2 lsb-release vim ca-certificates && \ + add-apt-repository ppa:deadsnakes/ppa -y && \ + apt update && \ + DEBIAN_FRONTEND=noninteractive TZ=Europe/Rome apt install -y python3.12 python-is-python3 && \ + ln -sf /usr/bin/python3.12 /usr/bin/python3 && \ + curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 && \ + rm -rf /var/lib/apt/lists/* + +# Install Envoy +RUN curl -sL 'https://apt.envoyproxy.io/signing.key' | gpg --dearmor -o /usr/share/keyrings/envoy-keyring.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/envoy-keyring.gpg] https://apt.envoyproxy.io $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/envoy.list && \ + apt update && \ + apt install -y envoy && \ + rm -rf /var/lib/apt/lists/* + +# Copy source files and install Python dependencies COPY src/requirements.txt LMF/src/ - -RUN pip install --ignore-installed -r LMF/src/requirements.txt -RUN pip install --force-reinstall websocket-client - +RUN pip install --ignore-installed -r LMF/src/requirements.txt && \ + pip install --force-reinstall websocket-client COPY ../envoy_proxy/envoy.yaml /etc/envoy/envoy.yaml - - COPY LICENSE LMF/ -# COPY src/config.py LMF/src/ -COPY src/HandleLocation.py src/lmf_instance.py src/lmf_server_api.py src/LPP_handler.py src/LPP_message_gen.py LMF/src/ -COPY src/custom_log.py src/NRPPa_handler.py src/NRPPa_message_gen.py src/positiong_algorithm.py src/requirements.txt LMF/src/ +COPY src/*.py LMF/src/ COPY src/start.sh LMF/ - -# RUN envoy -c /etc/envoy/envoy.yaml & - WORKDIR LMF -CMD [ "/bin/bash", "start.sh"] +CMD [ "/bin/bash", "start.sh" ] \ No newline at end of file