Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

Changed Dockerfile so it uses a special entrypoint script. All parameters are passed through to weed. Depending on the command the entrypoint.sh script adds parameters to link containers.

Jesper Zedlitz1c3670630682
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index e87538fdbb..0000000000
--- 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 0000000000..ed1c4dfe3d
--- /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 0000000000..bdde2caa4a
--- /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