Merge pull request #366 from jze/master

Changed Dockerfile so it uses a special entrypoint script.
This commit is contained in:
Chris Lu 2016-09-08 20:50:07 -07:00 committed by GitHub
commit 603f8e4f86
3 changed files with 52 additions and 21 deletions

View file

@ -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 Normal file
View file

@ -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 Executable file
View file

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