forked from k8ssandra/management-api-for-apache-cassandra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-4_0
116 lines (95 loc) · 5.56 KB
/
Dockerfile-4_0
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
ARG CASSANDRA_VERSION=4.0.10
FROM --platform=$BUILDPLATFORM maven:3.8.7-eclipse-temurin-11 as builder
ARG METRICS_COLLECTOR_VERSION=0.3.4
ARG CDC_AGENT_VERSION=2.2.9
ARG CDC_AGENT_EDITION=agent-c4
WORKDIR /build
ENV MAAC_PATH /opt/management-api
COPY pom.xml ./
COPY management-api-agent-common/pom.xml ./management-api-agent-common/pom.xml
COPY management-api-agent-3.x/pom.xml ./management-api-agent-3.x/pom.xml
COPY management-api-agent-4.x/pom.xml ./management-api-agent-4.x/pom.xml
COPY management-api-agent-4.1.x/pom.xml ./management-api-agent-4.1.x/pom.xml
COPY management-api-common/pom.xml ./management-api-common/pom.xml
COPY management-api-server/pom.xml ./management-api-server/pom.xml
# this duplicates work done in the next steps, but this should provide
# a solid cache layer that only gets reset on pom.xml changes
RUN mvn -q -ff -T 1C install -DskipOpenApi && rm -rf target
COPY management-api-agent-common ./management-api-agent-common
COPY management-api-agent-3.x ./management-api-agent-3.x
COPY management-api-agent-4.x ./management-api-agent-4.x
COPY management-api-agent-4.1.x ./management-api-agent-4.1.x
COPY management-api-common ./management-api-common
COPY management-api-server ./management-api-server
RUN mkdir -m 775 ${MAAC_PATH} && \
mvn -q -ff package -DskipTests -DskipOpenApi && \
find /build -type f -name "datastax-*.jar" -exec mv -t $MAAC_PATH -i '{}' + && \
rm $MAAC_PATH/datastax-mgmtapi-agent-3* && \
rm $MAAC_PATH/datastax-mgmtapi-*common* && \
cd ${MAAC_PATH} && \
ln -s datastax-mgmtapi-agent-4.x-0.1.0-SNAPSHOT.jar datastax-mgmtapi-agent-0.1.0-SNAPSHOT.jar && \
ln -s datastax-mgmtapi-agent-0.1.0-SNAPSHOT.jar datastax-mgmtapi-agent.jar && \
ln -s datastax-mgmtapi-server-0.1.0-SNAPSHOT.jar datastax-mgmtapi-server.jar && \
chmod -R g+w ${MAAC_PATH}
# Download and extract Metrics Collector
ENV MCAC_PATH /opt/metrics-collector
RUN mkdir -m 775 ${MCAC_PATH} && \
if test ! -e datastax-mcac-agent-${METRICS_COLLECTOR_VERSION}.tar.gz; then curl -L -O "https://github.com/datastax/metric-collector-for-apache-cassandra/releases/download/v${METRICS_COLLECTOR_VERSION}/datastax-mcac-agent-${METRICS_COLLECTOR_VERSION}.tar.gz"; fi && \
tar --directory ${MCAC_PATH} --strip-components 1 --gzip --extract --file datastax-mcac-agent-${METRICS_COLLECTOR_VERSION}.tar.gz && \
chmod -R g+w ${MCAC_PATH}
ENV USER_HOME_PATH /home/cassandra
RUN mkdir -m 775 ${USER_HOME_PATH}
# Download CDC agent
ENV CDC_AGENT_PATH=/opt/cdc_agent
RUN mkdir -m 775 ${CDC_AGENT_PATH} && \
curl -L -O "https://github.com/datastax/cdc-apache-cassandra/releases/download/v${CDC_AGENT_VERSION}/${CDC_AGENT_EDITION}-${CDC_AGENT_VERSION}-all.jar" && \
mv ${CDC_AGENT_EDITION}-${CDC_AGENT_VERSION}-all.jar ${CDC_AGENT_PATH}/cdc-agent.jar && \
chmod -R g+w ${CDC_AGENT_PATH}
FROM cassandra:${CASSANDRA_VERSION} as oss40
ARG TARGETARCH
LABEL maintainer="DataStax, Inc <[email protected]>"
LABEL name="Apache Cassandra"
LABEL vendor="DataStax, Inc"
LABEL release="${CASSANDRA_VERSION}"
LABEL summary="Apache Cassandra is an open source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Cassandra offers robust support for clusters spanning multiple datacenters, with asynchronous masterless replication allowing low latency operations for all clients."
LABEL description="Apache Cassandra is an open source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Cassandra offers robust support for clusters spanning multiple datacenters, with asynchronous masterless replication allowing low latency operations for all clients."
ENV CASSANDRA_PATH /opt/cassandra
ENV MAAC_PATH /opt/management-api
ENV MCAC_PATH /opt/metrics-collector
ENV CDC_AGENT_PATH=/opt/cdc_agent
ENV USER_HOME_PATH /home/cassandra
ENV CASSANDRA_HOME ${CASSANDRA_PATH}
ENV CASSANDRA_CONF ${CASSANDRA_PATH}/conf
ENV CASSANDRA_LOGS ${CASSANDRA_PATH}/logs
# Log directory for Management API startup logs to avoid issues:
# https://datastax.jira.com/browse/DB-4627
# https://issues.apache.org/jira/browse/CASSANDRA-16027
ENV MGMT_API_LOG_DIR /var/log/cassandra
COPY --from=builder --chown=cassandra:root ${MAAC_PATH} ${MAAC_PATH}
COPY --from=builder --chown=cassandra:root ${MCAC_PATH} ${MCAC_PATH}
COPY --from=builder --chown=cassandra:root ${USER_HOME_PATH} ${USER_HOME_PATH}
COPY --from=builder --chown=cassandra:root ${CDC_AGENT_PATH} ${CDC_AGENT_PATH}
# Setup user and fixup permissions
RUN chown -R cassandra:root ${CASSANDRA_PATH} && chmod -R g+w ${CASSANDRA_PATH} && \
# we don't need recursive chnages here because the files in the directories already have group write
chmod g+w ${MAAC_PATH} ${MCAC_PATH} ${USER_HOME_PATH} ${CDC_AGENT_PATH}
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini
RUN chmod +x /tini
RUN set -eux; \
rm -fr /etc/apt/sources.list.d/*; \
rm -rf /var/lib/apt/lists/*; \
apt-get update; \
apt-get install -y --no-install-recommends wget iproute2; \
rm -rf /var/lib/apt/lists/*
# backwards compat with upstream ENTRYPOINT
COPY scripts/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
ln -sf /usr/local/bin/docker-entrypoint.sh /docker-entrypoint.sh && \
# fix for the missing mtab in the containerd
ln -sf /proc/mounts /etc/mtab
EXPOSE 9103 9000
EXPOSE 8080
USER cassandra
ENTRYPOINT ["/tini", "-g", "--", "/docker-entrypoint.sh"]
CMD ["mgmtapi"]