18
18
#
19
19
20
20
# First create a stage with just the Pulsar tarball and scripts
21
- FROM busybox as pulsar
22
-
23
- ARG PULSAR_TARBALL
24
-
25
- ADD ${PULSAR_TARBALL} /
26
- RUN mv /apache-pulsar-* /pulsar
27
- RUN rm -rf /pulsar/bin/*.cmd
28
-
29
- COPY scripts/apply-config-from-env.py /pulsar/bin
30
- COPY scripts/apply-config-from-env-with-prefix.py /pulsar/bin
31
- COPY scripts/gen-yml-from-env.py /pulsar/bin
32
- COPY scripts/generate-zookeeper-config.sh /pulsar/bin
33
- COPY scripts/pulsar-zookeeper-ruok.sh /pulsar/bin
34
- COPY scripts/watch-znode.py /pulsar/bin
35
- COPY scripts/install-pulsar-client.sh /pulsar/bin
36
-
37
- # The final image needs to give the root group sufficient permission for Pulsar components
38
- # to write to specific directories within /pulsar
39
- # The file permissions are preserved when copying files from this builder image to the target image.
40
- RUN for SUBDIRECTORY in conf data download logs; do \
41
- [ -d /pulsar/$SUBDIRECTORY ] || mkdir /pulsar/$SUBDIRECTORY; \
42
- chmod -R g+w /pulsar/$SUBDIRECTORY; \
43
- done
44
-
45
- # Trino writes logs to this directory (at least during tests), so we need to give the process permission
46
- # to create those log directories. This should be removed when Trino is removed.
47
- RUN chmod g+w /pulsar/trino
48
-
49
- # ## Create 2nd stage from Ubuntu image
50
- # ## and add OpenJDK and Python dependencies (for Pulsar functions)
51
-
52
- FROM ubuntu:22.04
53
-
54
- ARG DEBIAN_FRONTEND=noninteractive
55
- ARG UBUNTU_MIRROR=mirror://mirrors.ubuntu.com/mirrors.txt
56
- ARG UBUNTU_SECURITY_MIRROR=http://security.ubuntu.com/ubuntu/
57
-
58
- # Install some utilities
59
- RUN sed -i -e "s|http://archive\. ubuntu\. com/ubuntu/|${UBUNTU_MIRROR:-mirror://mirrors.ubuntu.com/mirrors.txt}|g" \
60
- -e "s|http://security\. ubuntu\. com/ubuntu/|${UBUNTU_SECURITY_MIRROR:-http://security.ubuntu.com/ubuntu/}|g" /etc/apt/sources.list \
61
- && echo 'Acquire::http::Timeout "30";\n Acquire::ftp::Timeout "30";\n Acquire::Retries "3";' > /etc/apt/apt.conf.d/99timeout_and_retries \
62
- && apt-get update \
63
- && apt-get -y dist-upgrade \
64
- && apt-get -y install --no-install-recommends netcat dnsutils less procps iputils-ping \
65
- python3 python3-kazoo python3-pip \
66
- curl ca-certificates wget apt-transport-https
67
-
68
- # Install Eclipse Temurin Package
69
- RUN mkdir -p /etc/apt/keyrings \
70
- && wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc \
71
- && echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list \
72
- && apt-get update \
73
- && apt-get -y dist-upgrade \
74
- && apt-get -y install temurin-17-jdk \
75
- && export ARCH=$(uname -m | sed -r 's/aarch64/arm64/g' | awk '!/arm64/{$0="amd64"}1' ) \
76
- && echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/temurin-17-jdk-$ARCH/conf/security/java.security \
77
-
78
- # Cleanup apt
79
- RUN apt-get -y --purge autoremove \
80
- && apt-get autoclean \
81
- && apt-get clean \
82
- && rm -rf /var/lib/apt/lists/*
83
-
84
- RUN pip3 install pyyaml==5.4.1
85
-
86
- # Pulsar currently writes to the below directories, assuming the default configuration.
87
- # Note that number 4 is the reason that pulsar components need write access to the /pulsar directory.
88
- # 1. /pulsar/data - both bookkeepers and zookeepers use this directory
89
- # 2. /pulsar/logs - function workers write to this directory and pulsar-admin initializes this directory
90
- # 3. /pulsar/download - functions write to this directory
91
- # 4. /pulsar - hadoop writes to this directory
92
- RUN mkdir /pulsar && chmod g+w /pulsar
93
-
94
- ENV PULSAR_ROOT_LOGGER=INFO,CONSOLE
95
-
96
- COPY --from=pulsar /pulsar /pulsar
97
- WORKDIR /pulsar
98
-
99
- ARG PULSAR_CLIENT_PYTHON_VERSION
100
- ENV PULSAR_CLIENT_PYTHON_VERSION ${PULSAR_CLIENT_PYTHON_VERSION}
101
-
102
- # This script is intentionally run as the root user to make the dependencies available for all UIDs.
103
- RUN chmod +x /pulsar/bin/install-pulsar-client.sh
104
- RUN /pulsar/bin/install-pulsar-client.sh
105
-
106
- # The UID must be non-zero. Otherwise, it is arbitrary. No logic should rely on its specific value.
107
- USER 10000
21
+ FROM ubuntu:22.04
0 commit comments