diff --git a/docker/Dockerfile.go_build b/docker/Dockerfile.go_build index d103db966..f215a21b2 100644 --- a/docker/Dockerfile.go_build +++ b/docker/Dockerfile.go_build @@ -7,15 +7,12 @@ COPY go.mod . COPY go.sum . RUN go mod download -ADD https://api.github.com/repos/Dando-Real-ITA/seaweedfs/git/refs/heads/develop version.json -RUN git clone --depth 1 https://github.com/Dando-Real-ITA/seaweedfs -b develop seaweedfs +ADD https://api.github.com/repos/chrislusf/seaweedfs/git/refs/heads/master version.json +RUN git clone --depth 1 https://github.com/chrislusf/seaweedfs seaweedfs WORKDIR seaweedfs/weed RUN go install FROM alpine AS final -RUN \ - apk add --no-cache --update bind-tools bash && \ - rm -rf /tmp/* LABEL author="Chris Lu" COPY --from=builder /root/go/bin/weed /usr/bin/ RUN mkdir -p /etc/seaweedfs @@ -43,6 +40,5 @@ RUN mkdir -p /data/filerldb2 VOLUME /data RUN chmod +x /entrypoint.sh -RUN chmod +x /start.sh -ENTRYPOINT ["/start.sh"] +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/start.sh b/docker/start.sh deleted file mode 100644 index 200bcf776..000000000 --- a/docker/start.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash -# -*- coding: utf-8 -*- -# 2020-10-09 20:03:59 - -######################################################################################################################################################################################################################## - -sleep 3 - -# Read all commands -ARGS="" -IP="" -CIP="" -for ARG in $@; do - # Detect a *peers command - if [[ $ARG == *"peers="* ]]; then - # TODO detect quotes after the = - OPTION=$(expr "$ARG" : '\(.*=\)') - VALUE=$(expr "$ARG" : '.*=\(.*\)') - - echo "Detected ${OPTION}" - - # Split all peers - PEERS="" - IFS=',' read -ra ADDRS <<< "$VALUE" - for ADDR in "${ADDRS[@]}"; do - # Get HOST:PORT - HOST=$(expr "$ADDR" : '\(.*\):') - PORT=$(expr "$ADDR" : '.*:\(.*\)') - # Add directly IP peers - if [[ $HOST =~ ^[0-9\.]+$ ]]; then - PEERS=${PEERS:+${PEERS},}${HOST}:${PORT} - else - echo "Getting IPs for ${HOST}" - - # Get all tasks ips - typeset -i nbt - nbt=0 - SECONDS=0 - - echo "Waiting for the min peers count (${CLUSTER_SIZE})" - - while [[ $nbt -lt ${CLUSTER_SIZE} ]]; do - tips=$(dig @127.0.0.11 +short tasks.${HOST}) - nbt=$(echo $tips | wc -w) - [[ $SECONDS -gt 120 ]] && break - sleep 1 - done - for tip in $tips; do - echo "Adding peer: ${tip}" - PEERS=${PEERS:+${PEERS},}${tip}:${PORT} - - cip=$(grep ${tip} /etc/hosts | awk '{print $1}' | head -1) - if [[ -n "$cip" ]]; then - echo "Found current ip: ${cip}" - CIP="-ip=${cip}" - fi - done - - # TODO handle normal hostnames correctly, in case no service is found - # # Get all direct ips - # ips=$(dig @127.0.0.11 +short ${HOST}) - # for ip in $ips; do - # echo "Adding peer: ${ip}" - # PEERS=${PEERS:+${PEERS},}${ip}:${PORT} - # done - fi - done - - ARG=${PEERS:+${OPTION}${PEERS}} - # Detect an ip command - elif [[ $ARG == *"ip="* ]]; then - # Save the IP as a fallback - IP=$ARG - # Not writing the ip for now - ARG="" - fi - ARGS=${ARGS:+${ARGS} }$ARG -done - -if ! [ -z "$CIP" ]; then - ARGS=${ARGS:+${ARGS} }$CIP -elif ! [ -z "$IP" ]; then - ARGS=${ARGS:+${ARGS} }$IP -fi - -exec /entrypoint.sh $ARGS - -########################################################################################################################################################################################################################