aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile21
-rw-r--r--docker/Dockerfile18
-rwxr-xr-xdocker/entrypoint.sh34
3 files changed, 52 insertions, 21 deletions
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index e87538fdb..000000000
--- a/Dockerfile
+++ /dev/null
@@ -1,21 +0,0 @@
-FROM progrium/busybox
-
-WORKDIR /opt/weed
-
-RUN opkg-install curl
-RUN echo tlsv1 >> ~/.curlrc
-
-RUN \
- curl -Lks https://bintray.com$(curl -Lk http://bintray.com/chrislusf/seaweedfs/seaweedfs/_latestVersion | grep linux_amd64.tar.gz | sed -n "/href/ s/.*href=['\"]\([^'\"]*\)['\"].*/\1/gp") | gunzip | tar -xf - -C /opt/weed/ && \
- mkdir ./bin && mv ./*/* ./bin && \
- chmod +x ./bin/weed
-
-EXPOSE 8080
-EXPOSE 9333
-
-VOLUME /data
-
-ENV WEED_HOME /opt/weed
-ENV PATH ${PATH}:${WEED_HOME}/bin
-
-ENTRYPOINT ["weed"]
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 000000000..ed1c4dfe3
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,18 @@
+FROM progrium/busybox
+
+COPY entrypoint.sh /entrypoint.sh
+COPY Dockerfile /etc/Dockerfile
+
+RUN opkg-install curl
+RUN echo tlsv1 >> ~/.curlrc
+
+RUN curl -Lks https://bintray.com$(curl -Lk http://bintray.com/chrislusf/seaweedfs/seaweedfs/_latestVersion | grep linux_amd64.tar.gz | sed -n "/href/ s/.*href=['\"]\([^'\"]*\)['\"].*/\1/gp") | gunzip | tar -xf - && \
+ mv go_*amd64/weed /usr/bin/ && \
+ rm -r go_*amd64
+
+EXPOSE 8080
+EXPOSE 9333
+
+VOLUME /data
+
+ENTRYPOINT ["/entrypoint.sh"]
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
new file mode 100755
index 000000000..bdde2caa4
--- /dev/null
+++ b/docker/entrypoint.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+case "$1" in
+
+ 'master')
+ ARGS="-ip `hostname -i` -mdir /data"
+ # Is this instance linked with an other master? (Docker commandline "--link master1:master")
+ if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
+ ARGS="$ARGS -peers=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
+ fi
+ /usr/bin/weed $@ $ARGS
+ ;;
+
+ 'volume')
+ ARGS="-ip `hostname -i` -dir /data"
+ # Is this instance linked with a master? (Docker commandline "--link master1:master")
+ if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
+ ARGS="$ARGS -mserver=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
+ fi
+ /usr/bin/weed $@ $ARGS
+ ;;
+
+ 'server')
+ ARGS="-ip `hostname -i` -dir /data"
+ if [ -n "$MASTER_PORT_9333_TCP_ADDR" ] ; then
+ ARGS="$ARGS -master.peers=$MASTER_PORT_9333_TCP_ADDR:$MASTER_PORT_9333_TCP_PORT"
+ fi
+ /usr/bin/weed $@ $ARGS
+ ;;
+
+ *)
+ /usr/bin/weed $@
+ ;;
+esac