Skip to content

Instantly share code, notes, and snippets.

@wwoods
Created April 10, 2020 15:21
Show Gist options
  • Save wwoods/c1eeb5f571f4f02f4e12b02633806aa6 to your computer and use it in GitHub Desktop.
Save wwoods/c1eeb5f571f4f02f4e12b02633806aa6 to your computer and use it in GitHub Desktop.
FROM ubuntu:18.04
RUN \
apt-get update \
&& apt-get install -y mongodb
ADD https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-amd64.tar.gz /tmp/
RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C /
# Setup service files to automatically run mongodb in the background
# and log using s6-overlay's logutil-service
RUN \
mkdir -p /data/db \
&& mkdir /etc/services.d/mongod \
&& echo "#! /usr/bin/with-contenv /bin/sh\nmongod >/dev/null 2>/dev/null" >> /etc/services.d/mongod/run \
&& chmod a+x /etc/services.d/mongod/run \
&& mkdir /etc/services.d/mongod/log \
&& echo "#!/usr/bin/execlineb -P\ns6-setuidgid mongodb logutil-service /var/log/mongodbz" >> /etc/services.d/mongod/log/run \
&& chmod a+x /etc/services.d/mongod/log/run
ENTRYPOINT ["/init"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment