FROM postgres:9.6.1

ENV STSENTINEL_CLUSTER_NAME=stolon-cluster \
    STSENTINEL_STORE_BACKEND=etcdv3 \
    STSENTINEL_STORE_ENDPOINTS=http://localhost:2379 \
    STSENTINEL_INITIAL_CLUSTER_SPEC=/etc/stolon/init-spec.json

COPY bin/stolon-sentinel bin/stolonctl /usr/local/bin/
COPY etc/init-spec.json ${STSENTINEL_INITIAL_CLUSTER_SPEC}
RUN chmod +x /usr/local/bin/stolon-sentinel /usr/local/bin/stolonctl

USER postgres
ENTRYPOINT ["stolon-sentinel"]
