Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 17, 2020 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/0fa7d63d44a3073746abff1d07602e63 to your computer and use it in GitHub Desktop.
Save velotiotech/0fa7d63d44a3073746abff1d07602e63 to your computer and use it in GitHub Desktop.
Velotio - HashiCorp Consul Part 2 - Dockerfile for MongoDB Docker Container
FROM ubuntu:18.04
RUN apt-get update && \
apt-get install -y \
bash curl nano net-tools zip unzip \
jq dnsutils iputils-ping
# Install MongoDB
RUN apt-get install -y mongodb
RUN mkdir -p /data/db
VOLUME data:/data/db
# Setup Consul and Goreman
ADD https://releases.hashicorp.com/consul/1.4.4/consul_1.4.4_linux_amd64.zip /tmp/consul.zip
RUN cd /bin && unzip /tmp/consul.zip && chmod +x /bin/consul && rm /tmp/consul.zip
ADD https://github.com/mattn/goreman/releases/download/v0.0.10/goreman_linux_amd64.zip /tmp/goreman.zip
RUN cd /bin && unzip /tmp/goreman.zip && chmod +x /bin/goreman && rm /tmp/goreman.zip
RUN mkdir -p /etc/consul.d/check_scripts
ADD ./config/mongod /etc
RUN mkdir -p /etc/checks
ADD ./config/checks /opt/checks
ADD checks_toggler.sh /opt
ADD mongo.sh /opt
ADD consul.sh /opt
ADD Procfile /root/Procfile
EXPOSE 27017
# Launch both MongoDB server and Consul
ENTRYPOINT [ "goreman" ]
CMD [ "-f", "/root/Procfile", "start" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment