Browse Source

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.

pull/366/head
Jesper Zedlitz 8 years ago
parent
commit
1c36706306
  1. 21
      Dockerfile
  2. 18
      docker/Dockerfile
  3. 34
      docker/entrypoint.sh

21
Dockerfile

@ -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"]

18
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"]

34
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
Loading…
Cancel
Save