From 3644482d93b90dab532797bb7eeaacd7e11a7cae Mon Sep 17 00:00:00 2001 From: nuwang <2070605+nuwang@users.noreply.github.com> Date: Thu, 19 Dec 2024 19:12:51 +0530 Subject: [PATCH] Add docker image for kubernetes helm chart --- docker/kubernetes/Dockerfile | 57 ++++++++++++++++++++++++++++++++++++ docker/kubernetes/Makefile | 9 ++++++ 2 files changed, 66 insertions(+) create mode 100644 docker/kubernetes/Dockerfile create mode 100644 docker/kubernetes/Makefile diff --git a/docker/kubernetes/Dockerfile b/docker/kubernetes/Dockerfile new file mode 100644 index 00000000..1dbbcd31 --- /dev/null +++ b/docker/kubernetes/Dockerfile @@ -0,0 +1,57 @@ +FROM python:3.13-slim AS builder + +ENV PYTHONUNBUFFERED=1 +ENV DEBIAN_FRONTEND=noninteractive + +#====================================================== +# Builder - Create virtualenv for Pulsar +#====================================================== +RUN apt-get update \ + && apt-get install -y --no-install-recommends apt-transport-https \ + # Install packages + && apt-get update \ + && apt-get install -y --no-install-recommends gcc \ + libcurl4-openssl-dev \ + bzip2 virtualenv \ + && mkdir /pulsar + +WORKDIR /pulsar + +COPY pulsar_app-*-py2.py3-none-any.whl . +COPY requirements.txt . + +# Install Pulsar Python requirements +RUN virtualenv .venv \ + && . .venv/bin/activate \ + && pip install wheel pykube-ng \ + && pip install -r requirements.txt Paste \ + && pip install `ls pulsar_app-*-py2.py3-none-any.whl`\[galaxy_extended_metadata,web,amqp\] + +# generate default pulsar config +RUN .venv/bin/pulsar-config --host 0.0.0.0 + +#====================================================== +# Final image - Copy virtualenv for Pulsar +#====================================================== +FROM python:3.13-slim + +ENV PYTHONUNBUFFERED=1 +ENV DEBIAN_FRONTEND=noninteractive +ENV PULSAR_CONFIG_PRIVATE_TOKEN=change_me + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libcurl4-openssl-dev \ + bzip2 virtualenv \ + && adduser --disabled-password --gecos '' pulsar \ + && mkdir /pulsar \ + && chown pulsar:pulsar /pulsar + +WORKDIR /pulsar +COPY --chown=pulsar:pulsar --from=builder /pulsar . + +USER pulsar + +EXPOSE 8913 + +CMD [".venv/bin/pulsar"] diff --git a/docker/kubernetes/Makefile b/docker/kubernetes/Makefile new file mode 100644 index 00000000..df68cf9e --- /dev/null +++ b/docker/kubernetes/Makefile @@ -0,0 +1,9 @@ + + +dist: + cd ../..; make dist; cp dist/pulsar*whl docker/kubernetes; cp requirements.txt docker/kubernetes + +docker-image: + docker build -t 'galaxy/pulsar-kubernetes:0.15.7' . + +all: dist docker-image