dockerizing_cassandra/Dockerfile

39 lines
1.3 KiB
Docker
Raw Permalink Normal View History

2024-07-24 15:03:39 +02:00
# Use the official Cassandra 4.1.3 image
FROM cassandra:4.1.3
# Install gettext to use envsubst
# RUN apt-get update && apt-get install -y iputils-ping less locate gettext-base
2024-07-24 15:41:02 +02:00
2024-07-24 15:03:39 +02:00
# Environment variables to configure Cassandra
ENV CASSANDRA_CLUSTER_NAME=TestCluster
ENV CASSANDRA_NUM_TOKENS=256
ENV CASSANDRA_DC=DC1
ENV CASSANDRA_RACK=RAC1
# Create directory for dump files
2024-07-30 17:03:33 +02:00
# RUN mkdir -p /dump/snapshot
2024-07-24 15:03:39 +02:00
# Copy the CQL script to create the keyspace and tables
2024-07-30 17:03:33 +02:00
# COPY data/dumps/schema/dev_keyspace_1_schema.cql /dump/dev_keyspace_1_schema.cql
2024-07-24 15:03:39 +02:00
# Copy the setup script
# Copy cassandra.yaml and cassandra-rackdc.properties
2024-07-24 15:41:02 +02:00
COPY cassandra.yaml /etc/cassandra/
# COPY cassandra-rackdc.properties /etc/cassandra/
# Substitute environment variables in cassandra.yaml
# RUN envsubst < /etc/cassandra/cassandra.yaml > /etc/cassandra/cassandra.yaml.tmp && mv /etc/cassandra/cassandra.yaml.tmp /etc/cassandra/cassandra.yaml
# Substitute environment variables in cassandra-rackdc.properties
# RUN envsubst < /etc/cassandra/cassandra-rackdc.properties > /etc/cassandra/cassandra-rackdc.properties.tmp && mv /etc/cassandra/cassandra-rackdc.properties.tmp /etc/cassandra/cassandra-rackdc.properties
2024-07-24 15:41:02 +02:00
2024-07-30 17:03:33 +02:00
# COPY scripts/setup.sh /setup.sh
# VOLUME "/scripts/setup.sh"
2024-07-24 15:03:39 +02:00
# Set the entrypoint
# ENTRYPOINT ["/scripts/setup.sh"]
2024-07-24 15:03:39 +02:00
# Expose Cassandra ports
EXPOSE 7000 7001 7199 9042 9160