## Note: alpine version >= 3.9 is required to get mongodb version 4
## is a simple copy of alpine:3.9
FROM docker.0k.io/alpine:3.9 as common

## mongodb-tools is only required because we expect and use mongodump
## XXXvlab: bash is only required by mongo-backup, we could probably only use sh
RUN apk add --no-cache mongodb mongodb-tools bash

RUN mkdir -p /var/lib/mongod
RUN chown -R mongodb:mongodb /var/lib/mongod

VOLUME ["/var/lib/mongodb"]
EXPOSE 27017 28017

USER mongodb

ENTRYPOINT [ "mongod", "--config", "/etc/mongod.conf" ]