FROM mongo:4.4

# Prepare the base image
RUN apt-get update && \
    apt-get install -y vim && \
    apt-get install -y openssl && \
    apt-get clean


RUN openssl rand -base64 756 > mongodb-keyfile && \
    mv mongodb-keyfile /etc/ssl && \
    chown mongodb:mongodb /etc/ssl/mongodb-keyfile && \
    chmod 400 /etc/ssl/mongodb-keyfile

#Copy file with authentication users
COPY Docker/mongo-users.js /
RUN chmod 775 mongo-users.js


EXPOSE 27017
