initial codes try 2
This commit is contained in:
15
Dockerfile
15
Dockerfile
@@ -3,14 +3,19 @@ FROM ubuntu:24.04
|
|||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV APP_DIR=/opt/containers/nats-registration-listener
|
ENV APP_DIR=/opt/containers/nats-registration-listener
|
||||||
ENV DATA_DIR=${APP_DIR}/data
|
ENV DATA_DIR=${APP_DIR}/data
|
||||||
|
# venv path and ensure it’s first on PATH for runtime & build steps
|
||||||
|
ENV VENV_PATH=/opt/venv
|
||||||
|
ENV PATH=${VENV_PATH}/bin:${PATH}
|
||||||
|
|
||||||
# Minimal deps + Python + dos2unix for CRLF→LF
|
# Minimal deps + Python + venv + dos2unix for CRLF→LF
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
bash curl jq ca-certificates tini python3 python3-pip dos2unix \
|
bash curl jq ca-certificates tini python3 python3-venv python3-pip dos2unix \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Python deps
|
# Create a virtual environment and install python deps inside it
|
||||||
RUN pip3 install --no-cache-dir --upgrade nats-py
|
RUN python3 -m venv ${VENV_PATH} \
|
||||||
|
&& python -m pip install --no-cache-dir --upgrade pip \
|
||||||
|
&& python -m pip install --no-cache-dir --upgrade nats-py
|
||||||
|
|
||||||
# App payload (immutable inside image)
|
# App payload (immutable inside image)
|
||||||
RUN mkdir -p ${APP_DIR}/app/bin
|
RUN mkdir -p ${APP_DIR}/app/bin
|
||||||
@@ -19,7 +24,7 @@ COPY files/entrypoint.sh /usr/local/bin/nats-registration-entrypoint
|
|||||||
COPY files/healthcheck.sh /usr/local/bin/nats-registration-healthcheck
|
COPY files/healthcheck.sh /usr/local/bin/nats-registration-healthcheck
|
||||||
COPY files/nats_registration_listener.py /usr/local/bin/nats_registration_listener.py
|
COPY files/nats_registration_listener.py /usr/local/bin/nats_registration_listener.py
|
||||||
|
|
||||||
# Normalize line endings (in case files came from Windows) and set exec bits
|
# Normalize line endings & set exec bits (Windows-safe)
|
||||||
RUN dos2unix /usr/local/bin/nats-registration-entrypoint \
|
RUN dos2unix /usr/local/bin/nats-registration-entrypoint \
|
||||||
/usr/local/bin/nats-registration-healthcheck \
|
/usr/local/bin/nats-registration-healthcheck \
|
||||||
${APP_DIR}/app/bin/nats-registration-listener.sh \
|
${APP_DIR}/app/bin/nats-registration-listener.sh \
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ log(){ echo "[nats-registration][entrypoint] $*"; }
|
|||||||
err(){ echo "[nats-registration][entrypoint][ERROR] $*" >&2; }
|
err(){ echo "[nats-registration][entrypoint][ERROR] $*" >&2; }
|
||||||
|
|
||||||
# Sanity: tools
|
# Sanity: tools
|
||||||
for bin in curl jq python3; do
|
+for bin in curl jq python; do
|
||||||
command -v "$bin" >/dev/null 2>&1 || { err "Missing $bin"; exit 2; }
|
command -v "$bin" >/dev/null 2>&1 || { err "Missing $bin"; exit 2; }
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -57,4 +57,4 @@ if [[ -n "${PRINT_RAW:-}" ]]; then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec python3 /usr/local/bin/nats_registration_listener.py "${args[@]}"
|
exec python /usr/local/bin/nats_registration_listener.py "${args[@]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user