|
| 1 | +FROM ubuntu |
| 2 | +RUN echo 'Building new SuperDuper XJSON Docker image...' |
| 3 | +COPY test/testdata/ca-cert.pem /tmp/ |
| 4 | +RUN apt-get update && \ |
| 5 | + apt-get install -y software-properties-common && \ |
| 6 | + apt-add-repository -y ppa:jbboehr/coreos && \ |
| 7 | + apt-get update && \ |
| 8 | + apt-get install -qqy \ |
| 9 | + ca-certificates \ |
| 10 | + etcdctl |
| 11 | +RUN groupadd -r ctlog && useradd -r -g ctlog ctlog |
| 12 | +RUN mkdir /mnt/ctlog |
| 13 | +COPY cpp/server/xjson-server /usr/local/bin/ |
| 14 | +COPY test/testdata/ct-server-key.pem /usr/local/etc/server-key.pem |
| 15 | +COPY cpp/tools/ct-clustertool /usr/local/bin/ |
| 16 | +VOLUME /mnt/ctlog |
| 17 | +CMD cd /mnt/ctlog/ && \ |
| 18 | + if [ ! -d logs ]; then mkdir logs; fi && \ |
| 19 | + MY_IP=$(awk "/${HOSTNAME}/ {print \$1}" < /etc/hosts) && \ |
| 20 | + export V_LEVEL=${V_LEVEL:-0} && \ |
| 21 | + export NUM_HTTP_SERVER_THREADS=${NUM_HTTP_SERVER_THREADS:-32} && \ |
| 22 | + echo "My IP: ${MY_IP}" && \ |
| 23 | + echo "Container: ${CONTAINER_HOST}" && \ |
| 24 | + echo "Etcd: ${ETCD_SERVERS}" && \ |
| 25 | + echo "Project: ${PROJECT}" && \ |
| 26 | + echo "Monitoring: ${MONITORING}" && \ |
| 27 | + ulimit -c unlimited && \ |
| 28 | + /usr/local/bin/xjson-server \ |
| 29 | + --port=80 \ |
| 30 | + --server=${CONTAINER_HOST} \ |
| 31 | + --key=/usr/local/etc/server-key.pem \ |
| 32 | + --log_dir=/mnt/ctlog/logs \ |
| 33 | + --tree_signing_frequency_seconds=30 \ |
| 34 | + --guard_window_seconds=10 \ |
| 35 | + --leveldb_db=/mnt/ctlog/log.ldb \ |
| 36 | + --etcd_servers="${ETCD_SERVERS}" \ |
| 37 | + --etcd_delete_concurrency=100 \ |
| 38 | + --num_http_server_threads=${NUM_HTTP_SERVER_THREADS} \ |
| 39 | + --monitoring=${MONITORING} \ |
| 40 | + --google_compute_monitoring_base_url="https://www.googleapis.com/cloudmonitoring/v2beta2/projects/${PROJECT}" \ |
| 41 | + --v=${V_LEVEL}; \ |
| 42 | + if [ -e core ]; then \ |
| 43 | + CORE_DIR="/mnt/ctlog/cores/$(date +%s)"; \ |
| 44 | + mkdir -p ${CORE_DIR}; \ |
| 45 | + cp -v core ${CORE_DIR}; \ |
| 46 | + cp -v /usr/local/bin/xjson-server ${CORE_DIR}; \ |
| 47 | + echo "Core saved to ${CORE_DIR}"; \ |
| 48 | + fi |
| 49 | + |
| 50 | +EXPOSE 80 |
0 commit comments