-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (52 loc) · 2.03 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
FROM alpine:latest
MAINTAINER Jan Cajthaml <jan.cajthaml@gmail.com>
ENV S6_OVERLAY_VERSION v1.17.1.1
ENV GODNSMASQ_VERSION 0.9.8
RUN addgroup -S mongodb && \
adduser -S -G mongodb mongodb
RUN apk add --no-cache --virtual linux-headers && \
apk add --no-cache --virtual --update tar && \
apk add --no-cache --virtual git && \
apk add --no-cache --virtual curl && \
apk add --no-cache --virtual tcl && \
apk add --no-cache --virtual make && \
apk add --no-cache --virtual gcc && \
apk add --no-cache --virtual g++ && \
apk add --no-cache --virtual scons
RUN curl -sSL https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-amd64.tar.gz \
| tar xvz --no-same-owner -C / --strip-components 1 -f - && \
curl -sSL https://github.com/janeczku/go-dnsmasq/releases/download/${GODNSMASQ_VERSION}/go-dnsmasq-min_linux-amd64 -o /bin/go-dnsmasq && \
chmod +x /bin/go-dnsmasq
ENV MONGO_VERSION r3.4.0
RUN mkdir -p /tmp/mongo-stable && cd /tmp/mongo-stable && \
git clone git://github.com/mongodb/mongo.git --branch ${MONGO_VERSION} --single-branch --depth=1 .
RUN cd /tmp/mongo-stable && \
scons core install -j2 --prefix=/usr/local --disable-warnings-as-errors
#apk del openssl-dev && \
RUN apk del linux-headers && \
apk del curl && \
apk del git && \
apk del tcl && \
apk del make && \
apk del gcc && \
apk del g++ && \
apk del scons && \
rm -rf /var/cache/*
# Add the files
ADD etc /etc
ADD usr /usr
# Remove comment to lower size
RUN a=$(sed -e '/^[[:space:]]*$/d' -e '/^[[:space:]]*#/d' /etc/mongo.conf);echo "$a" > /etc/mongo.conf
# Local to broadcast
RUN sed -i -e 's/bind 127.0.0.1/bind 0.0.0.0/' /etc/mongo.conf
RUN mkdir -p /data && \
mkdir -p /var/lib/mongodb && \
mkdir -p /var/log/mongodb && \
chown -R mongodb:mongodb /data #&& \
#chown -R mongodb:mongodb /var/lib/mongodb && \
#chown -R mongodb:mongodb /var/log/mongodb
VOLUME ["/data"]
# Expose the ports for mongo
EXPOSE 27017 28017
ENTRYPOINT ["/init"]
CMD []