Add Docker configuration and entrypoint script for Nginx web service
This commit is contained in:
8
docker-compose.yml
Normal file
8
docker-compose.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
services:
|
||||
web:
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- "45554:80"
|
||||
volumes:
|
||||
- ./entrypoint.sh:/entrypoint.sh:ro
|
||||
entrypoint: ["/bin/sh", "/entrypoint.sh"]
|
||||
29
entrypoint.sh
Normal file
29
entrypoint.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
WEBROOT="/usr/share/nginx/html"
|
||||
GITEA_URL="https://gitea.reversed.dev"
|
||||
GITEA_REPO="space/time-until"
|
||||
|
||||
echo "Fetching latest release"
|
||||
|
||||
RELEASE_JSON=$(wget -qO- \
|
||||
"$GITEA_URL/api/v1/repos/$GITEA_REPO/releases/latest")
|
||||
|
||||
ASSET_URL=$(echo "$RELEASE_JSON" | sed -n 's/.*"browser_download_url" *: *"\([^"]*dist\.zip[^"]*\)".*/\1/p' | head -1)
|
||||
|
||||
if [ -z "$ASSET_URL" ]; then
|
||||
echo "ERROR: No dist.zip found in latest release"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Downloading $ASSET_URL ..."
|
||||
wget -qO /tmp/dist.zip --header="$AUTH_HEADER" "$ASSET_URL"
|
||||
|
||||
echo "Extracting to $WEBROOT ..."
|
||||
rm -rf "${WEBROOT:?}"/*
|
||||
unzip -o /tmp/dist.zip -d "$WEBROOT"
|
||||
rm /tmp/dist.zip
|
||||
|
||||
echo "Starting nginx ..."
|
||||
exec nginx -g "daemon off;"
|
||||
Reference in New Issue
Block a user