-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile
More file actions
106 lines (83 loc) · 4.2 KB
/
Dockerfile
File metadata and controls
106 lines (83 loc) · 4.2 KB
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
###############################################################################
# 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.
###############################################################################
# Same as the jvm image, but using locally built kafka
FROM eclipse-temurin:21-jre-alpine AS build-jsa
USER root
ARG kafka_version
COPY resources/distributions/kafka_2.13-$kafka_version.tgz /kafka.tgz
COPY inkless/jsa_launch /etc/kafka/docker/jsa_launch
RUN set -eux ; \
apk update ; \
apk upgrade ; \
apk add --no-cache wget gcompat gpg gpg-agent procps bash; \
mkdir opt/kafka; \
tar xfz kafka.tgz -C /opt/kafka --strip-components 1;
# Generate jsa files using dynamic CDS for kafka server start command and kafka storage format command
RUN /etc/kafka/docker/jsa_launch
FROM eclipse-temurin:21-jre-alpine
# exposed ports
EXPOSE 9092
USER root
ARG build_date
ARG kafka_version
COPY resources/distributions/kafka_2.13-$kafka_version.tgz /kafka.tgz
LABEL org.label-schema.name="inkless" \
org.label-schema.description="Inkless - Apache Kafka with object storage" \
org.label-schema.build-date="${build_date}" \
org.label-schema.vcs-url="https://github.com/aiven/inkless" \
org.opencontainers.image.source="https://github.com/aiven/inkless" \
maintainer="Aiven"
RUN set -eux ; \
apk update ; \
apk upgrade ; \
apk add --no-cache wget gcompat gpg gpg-agent procps bash; \
mkdir opt/kafka; \
tar xfz kafka.tgz -C /opt/kafka --strip-components 1; \
mkdir -p /var/lib/kafka/data /etc/kafka/secrets; \
mkdir -p /etc/kafka/docker /usr/logs /mnt/shared/config; \
adduser -h /home/appuser -D --shell /bin/bash appuser; \
chown appuser:appuser -R /usr/logs /opt/kafka /mnt/shared/config; \
chown appuser:root -R /var/lib/kafka /etc/kafka/secrets /etc/kafka; \
chmod -R ug+w /etc/kafka /var/lib/kafka /etc/kafka/secrets; \
cp /opt/kafka/config/log4j2.yaml /etc/kafka/docker/log4j2.yaml; \
cp /opt/kafka/config/tools-log4j2.yaml /etc/kafka/docker/tools-log4j2.yaml; \
apk del wget gpg gpg-agent; \
apk cache clean;
# Aiven Tiered Storage plugin (classic remote storage support)
ARG ts_plugin_version=1.1.1
ARG ts_plugin_base_url=https://github.com/Aiven-Open/tiered-storage-for-apache-kafka/releases/download/v${ts_plugin_version}
ADD ${ts_plugin_base_url}/core-${ts_plugin_version}.tgz /tmp/core.tgz
ADD ${ts_plugin_base_url}/s3-${ts_plugin_version}.tgz /tmp/s3.tgz
ADD ${ts_plugin_base_url}/gcs-${ts_plugin_version}.tgz /tmp/gcs.tgz
ADD ${ts_plugin_base_url}/azure-${ts_plugin_version}.tgz /tmp/azure.tgz
RUN mkdir -p /opt/tiered-storage-plugin/core \
/opt/tiered-storage-plugin/s3 \
/opt/tiered-storage-plugin/gcs \
/opt/tiered-storage-plugin/azure && \
tar xzf /tmp/core.tgz -C /opt/tiered-storage-plugin/core --strip-components=1 && \
tar xzf /tmp/s3.tgz -C /opt/tiered-storage-plugin/s3 --strip-components=1 && \
tar xzf /tmp/gcs.tgz -C /opt/tiered-storage-plugin/gcs --strip-components=1 && \
tar xzf /tmp/azure.tgz -C /opt/tiered-storage-plugin/azure --strip-components=1 && \
rm /tmp/*.tgz
COPY --from=build-jsa kafka.jsa /opt/kafka/kafka.jsa
COPY --from=build-jsa storage.jsa /opt/kafka/storage.jsa
COPY --chown=appuser:appuser resources/common-scripts /etc/kafka/docker
COPY --chown=appuser:appuser inkless/launch /etc/kafka/docker/launch
USER appuser
VOLUME ["/etc/kafka/secrets", "/var/lib/kafka/data", "/mnt/shared/config"]
CMD ["/etc/kafka/docker/run"]