forked from k8ssandra/management-api-for-apache-cassandra
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile-astra-4_0
68 lines (53 loc) · 2.78 KB
/
Dockerfile-astra-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
FROM maven:3.6.3-jdk-8-slim as builder
ARG METRICS_COLLECTOR_VERSION=0.1.9
WORKDIR /build
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-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 && 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-common ./management-api-common
COPY management-api-server ./management-api-server
RUN mvn -q -ff package -DskipTests
# Download and extract Metrics Collector
ENV MCAC_PATH /opt/metrics-collector
RUN mkdir ${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
FROM datastax/astra:4.0
ENV CASSANDRA_PATH /opt/cassandra
ENV MAAC_PATH /opt/management-api
ENV MCAC_PATH /opt/metrics-collector
ENV USER_HOME_PATH /home/cassandra
ENV CASSANDRA_HOME ${CASSANDRA_PATH}
ENV CASSANDRA_CONF ${CASSANDRA_PATH}/conf
ENV CASSANDRA_LOGS ${CASSANDRA_PATH}/logs
COPY --from=builder /build/management-api-agent-3.x/target/datastax-mgmtapi-agent-3.x-0.1.0-SNAPSHOT.jar ${MAAC_PATH}/datastax-mgmtapi-agent-0.1.0-SNAPSHOT.jar
COPY --from=builder /build/management-api-server/target/datastax-mgmtapi-server-0.1.0-SNAPSHOT.jar ${MAAC_PATH}/
COPY --from=builder ${MCAC_PATH} ${MCAC_PATH}
# Setup user and fixup permissions
RUN mkdir ${USER_HOME_PATH} && \
chown -R cassandra:root ${CASSANDRA_PATH} ${MAAC_PATH} ${MCAC_PATH} ${USER_HOME_PATH} && \
chmod -R g+w ${CASSANDRA_PATH} ${MAAC_PATH} ${MCAC_PATH}
ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends wget; \
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
EXPOSE 9103
EXPOSE 8080
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["mgmtapi"]