-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathDockerfile
170 lines (150 loc) · 6.12 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM golang:1.17.8-buster AS go
RUN go install github.com/rexray/gocsi/csc@latest
# Compile latest goofys for arm64 if necessary, which doesn't have a released binary
RUN set -eux ; \
ARCH="$(arch)"; \
if [ ${ARCH} = "aarch64" ]; then \
git clone https://github.com/kahing/goofys.git ; \
cd goofys ; \
git checkout 08534b2 ; \
go build ; \
mv goofys /go/bin/ ; \
elif [ ${ARCH} = "x86_64" ]; then \
curl -L https://github.com/kahing/goofys/releases/download/v0.24.0/goofys -o /go/bin/goofys ; \
else \
echo "Unsupported architecture: ${ARCH}"; \
exit 1 ; \
fi
FROM rockylinux:9.3
RUN set -eux ; \
dnf install -y \
bzip2 \
diffutils \
findutils \
fuse \
jq \
krb5-workstation \
libxcrypt-compat \
lsof \
ncurses \
net-tools \
nmap-ncat \
openssl \
procps \
python3 python3-pip \
snappy \
sudo \
zlib \
&& dnf clean all \
&& ln -sf /usr/bin/python3 /usr/bin/python
RUN sudo python3 -m pip install --upgrade pip
COPY --from=go /go/bin/csc /usr/bin/csc
# Install rclone for smoketest
RUN set -eux ; \
ARCH="$(arch)" ; \
case "${ARCH}" in \
x86_64) url='https://downloads.rclone.org/rclone-current-linux-amd64.rpm' ;; \
aarch64) url='https://downloads.rclone.org/rclone-current-linux-arm64.rpm' ;; \
*) echo "Unsupported architecture: ${ARCH}"; exit 1 ;; \
esac; \
curl -L -o /tmp/package.rpm "${url}"; \
dnf install -y /tmp/package.rpm; \
rm -f /tmp/package.rpm
#For executing inline smoketest
RUN set -eux ; \
pip3 install awscli robotframework==6.1.1 boto3 ; \
rm -r ~/.cache/pip
#dumb init for proper init handling
RUN set -eux ; \
ARCH="$(arch)"; \
case "${ARCH}" in \
x86_64) \
url='https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64'; \
sha256='e874b55f3279ca41415d290c512a7ba9d08f98041b28ae7c2acb19a545f1c4df'; \
;; \
aarch64) \
url='https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_aarch64'; \
sha256='b7d648f97154a99c539b63c55979cd29f005f88430fb383007fe3458340b795e'; \
;; \
*) echo "Unsupported architecture: ${ARCH}"; exit 1 ;; \
esac; \
curl -L ${url} -o dumb-init ; \
echo "${sha256} *dumb-init" | sha256sum -c - ; \
chmod +x dumb-init ; \
mv dumb-init /usr/local/bin/dumb-init
#byteman test for development
RUN curl -Lo /opt/byteman.jar https://repo.maven.apache.org/maven2/org/jboss/byteman/byteman/4.0.23/byteman-4.0.23.jar \
&& chmod o+r /opt/byteman.jar
#async profiler for development profiling
RUN set -eux ; \
ARCH="$(arch)" ; \
case "${ARCH}" in \
x86_64) url='https://github.com/jvm-profiling-tools/async-profiler/releases/download/v2.7/async-profiler-2.7-linux-x64.tar.gz' ;; \
aarch64) url='https://github.com/jvm-profiling-tools/async-profiler/releases/download/v2.7/async-profiler-2.7-linux-arm64.tar.gz' ;; \
*) echo "Unsupported architecture: ${ARCH}"; exit 1 ;; \
esac; \
curl -L ${url} | tar xvz ; \
mv async-profiler-* /opt/profiler
# OpenJDK 21
RUN set -eux ; \
ARCH="$(arch)"; \
case "${ARCH}" in \
x86_64) \
url='https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_linux-x64_bin.tar.gz'; \
sha256='a2def047a73941e01a73739f92755f86b895811afb1f91243db214cff5bdac3f'; \
;; \
aarch64) \
url='https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_linux-aarch64_bin.tar.gz'; \
sha256='08db1392a48d4eb5ea5315cf8f18b89dbaf36cda663ba882cf03c704c9257ec2'; \
;; \
*) echo "Unsupported architecture: ${ARCH}"; exit 1 ;; \
esac && \
curl -L ${url} -o openjdk.tar.gz && \
echo "${sha256} *openjdk.tar.gz" | sha256sum -c - && \
tar xzvf openjdk.tar.gz -C /usr/local && \
rm -f openjdk.tar.gz
ENV JAVA_HOME=/usr/local/jdk-21.0.2
# compatibility with Ozone 1.4.0 and earlier compose env.
RUN mkdir -p /usr/lib/jvm && ln -s $JAVA_HOME /usr/lib/jvm/jre
ENV LD_LIBRARY_PATH=/usr/local/lib
ENV PATH=/opt/hadoop/libexec:$PATH:$JAVA_HOME/bin:/opt/hadoop/bin
RUN id=1000; \
for u in hadoop om dn scm s3g recon testuser testuser2 httpfs; do \
groupadd --gid $id $u \
&& useradd --uid $id $u --gid $id --home /opt/$u \
&& mkdir /opt/$u \
&& chmod 755 /opt/$u; \
id=$(( id + 1 )); \
done
RUN echo "hadoop ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN chown hadoop /opt
# Prep for Kerberized cluster
RUN mkdir -p /etc/security/keytabs && chmod -R a+wr /etc/security/keytabs
COPY --chmod=644 krb5.conf /etc/
# CSI / k8s / fuse / goofys dependency
COPY --from=go --chmod=755 /go/bin/goofys /usr/bin/goofys
# Create hadoop and data directories. Grant all permission to all on them
RUN mkdir -p /etc/hadoop && mkdir -p /var/log/hadoop && chmod 1777 /etc/hadoop && chmod 1777 /var/log/hadoop
ENV OZONE_LOG_DIR=/var/log/hadoop
ENV OZONE_CONF_DIR=/etc/hadoop
RUN mkdir /data && chmod 1777 /data
# Set default entrypoint (used only if the ozone dir is not bind mounted)
COPY --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.sh
WORKDIR /opt/hadoop
USER hadoop
ENTRYPOINT ["/usr/local/bin/dumb-init", "--", "entrypoint.sh"]