Skip to content

Commit

Permalink
Installation script and Dockerfile fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ph3nol committed Sep 25, 2017
1 parent cae7a3c commit 62e3217
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ RUN set -xe && apk update && \
apk add --update wget && \
rm -rf /var/cache/apk/*

RUN wget -qO - https://raw.githubusercontent.com/Ph3nol/Docker-Arch/master/install.sh | sh
RUN curl -sSL https://raw.githubusercontent.com/Ph3nol/Docker-Arch/master/install.sh | sh

ENTRYPOINT ["/usr/local/bin/docker-arch"]
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,8 @@ docker pull ph3nol/docker-arch

## Use Docker-Arch from local installation (PHP 7.1+ required)

Using `curl`:

``` shell
curl -sSL https://raw.githubusercontent.com/Ph3nol/Docker-Arch/master/install.sh | bash
```

Using `wget`:

``` shell
wget -qO - https://raw.githubusercontent.com/Ph3nol/Docker-Arch/master/install.sh | bash
curl -sSL https://raw.githubusercontent.com/Ph3nol/Docker-Arch/master/install.sh | sh
```

## Docker-Arch environment generation
Expand Down
38 changes: 6 additions & 32 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,42 +1,16 @@
#!/bin/bash
#!/bin/sh

GITHUB_LAST_RELEASE_ENDPOINT="https://api.github.com/repos/Ph3nol/Docker-Arch/releases/latest"
DESTINATION_BIN_PATH="/usr/local/bin/docker-arch"

echo "--- Docker-Arch - Installation script ---"
echo ""
echo "Looking for your available download package..."

if [ -x "$(command -v wget)" ]
then
echo "> Going to use WGET to download PHAR package."
LATEST_RELEASE_CONDITION=$(wget -S --spider "$GITHUB_LAST_RELEASE_ENDPOINT" 2>&1 | grep 'HTTP/1.1 200 OK')
if [[ $LATEST_RELEASE_CONDITION ]]; then
PHAR_DOWNLOAD_LINK=$(curl -s "$GITHUB_LAST_RELEASE_ENDPOINT" | grep browser_download_url | cut -d '"' -f 4)
else
PHAR_DOWNLOAD_LINK="https://github.com/Ph3nol/Docker-Arch/raw/master/dist/docker-arch.phar"
fi
echo "• Downloading..."
wget --quiet --no-check-certificate -O /tmp/docker-arch "$PHAR_DOWNLOAD_LINK"
elif [ -x "$(command -v curl)" ]
then
echo "> Going to use CURL to download PHAR package."
LATEST_RELEASE_CONDITION=$(curl --write-out %{http_code} --silent --output /dev/null "$GITHUB_LAST_RELEASE_ENDPOINT")
if [[ "$LATEST_RELEASE_CONDITION" == "200" ]]; then
PHAR_DOWNLOAD_LINK=$(curl -s "$GITHUB_LAST_RELEASE_ENDPOINT" | grep browser_download_url | cut -d '"' -f 4)
else
PHAR_DOWNLOAD_LINK="https://github.com/Ph3nol/Docker-Arch/raw/master/dist/docker-arch.phar"
fi
echo "• Downloading..."
curl -L -s -o /tmp/docker-arch "$PHAR_DOWNLOAD_LINK"
else
echo "ERROR: no required `wget` or `curl` package has been found."
exit
fi
PHAR_DOWNLOAD_LINK=$(curl -s "$GITHUB_LAST_RELEASE_ENDPOINT" | grep browser_download_url | cut -d '"' -f 4)
echo "• Downloading from $PHAR_DOWNLOAD_LINK..."
curl -L -s -o /tmp/docker-arch "$PHAR_DOWNLOAD_LINK"

echo "• Installing..."
chmod +x /tmp/docker-arch
mv /tmp/docker-arch "$DESTINATION_BIN_PATH"
echo "• Done."
echo ""
echo "Enjoy! 🐳"

echo "• Done. Enjoy! 🐳"

0 comments on commit 62e3217

Please sign in to comment.