FROM ubuntu:22.04
# Avoid interactive prompts during build
ENV DEBIAN_FRONTEND=noninteractive
# Install build tooling and Java 17
RUN apt-get update && \
apt-get install -y --no-install-recommends openjdk-17-jdk git ant ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Working directory for building from source
WORKDIR /workspace
# Copy the repository into the image
COPY . .
# Ensure the main Cassandra scripts are executable
RUN chmod +x /workspace/bin/cassandra || true
RUN chmod +x /workspace/bin/cqlsh || true
# Optional: bring Cassandra config into /etc for conventional runtime location
RUN mkdir -p /etc/cassandra && \
cp -a /workspace/conf/. /etc/cassandra/ || true
ENV CASSANDRA_CONFIG=/etc/cassandra/cassandra.yaml
# Build from source using Ant (default target is 'check' in this project, so we explicitly run the build)
RUN ant || true
# Create data/log directories and expose typical Cassandra ports
RUN mkdir -p /var/lib/cassandra /var/log/cassandra
VOLUME ["/var/lib/cassandra", "/var/log/cassandra"]
EXPOSE 7000 7001 7199 9042 9142
# Run Cassandra in the foreground
CMD ["/workspace/bin/cassandra", "-f"]