A custom couchbase server image for use in the https://github.com/earthen/clj-cb project's github CI actions.
Dockerfile
FROM couchbase:latest
COPY configure.sh /configure.sh
HEALTHCHECK CMD curl -u Administrator:Admin123 --fail http://localhost:8091/pools || exit 1
ENTRYPOINT ["/configure.sh"]
configure.sh
#!/bin/bash
# Enables job control
set -m
# Enables error propagation
set -e
# Run the server and send it to the background
/entrypoint.sh couchbase-server &
# Check if couchbase server is up
check_db() {
curl --silent http://127.0.0.1:8091/pools > /dev/null
echo $?
}
# Variable used in echo
i=1
# Echo with
log() {
echo "[$i] [$(date +"%T")] $@"
i=`expr $i + 1`
}
# Wait until it's ready
until [[ $(check_db) = 0 ]]; do
>&2 log "Waiting for Couchbase Server to be available ..."
sleep 1
done
# Setup index and memory quota
log "$(date +"%T") Init cluster ........."
couchbase-cli cluster-init -c 127.0.0.1 --cluster-username Administrator --cluster-password Admin123 \
--cluster-name myCluster --cluster-ramsize 512 --cluster-index-ramsize 512 --services data,index,query,fts \
--index-storage-setting default
# Create the buckets
log "$(date +"%T") Create buckets ........."
couchbase-cli bucket-create -c 127.0.0.1 --username Administrator --password Admin123 --bucket-type couchbase --bucket-ramsize 250 --bucket earthen_test
# Create user
log "$(date +"%T") Create users ........."
couchbase-cli user-manage -c 127.0.0.1:8091 -u Administrator -p Admin123 --set --rbac-username earthen --rbac-password earthen \
--rbac-name "earthen" --roles bucket_full_access[*] --auth-domain local
fg 1
Content type
Image
Digest
Size
455.1 MB
Last updated
almost 7 years ago
docker pull fhitchen/clj-cb-testdb