A static Website hosting Image that auto-updates from Git Repo
783
A container to deliver static-websites pulling and auto-updating from github once an hour from container start. Try the below command for public repos with a simple website is pulled from github
Public Repo use this command
docker run -d --restart always -p 80:80 \
-e GIT_REPO_URL="https://github.com/meeaehlabs-uk/staticsite.git" \
-e GIT_BRANCH="hostinger" \
--name my-static-site \
meeaehlabs/static-site:latest
If you have a Private Repo you need to use the below command
docker run -d --restart always -p 80:80 \
-e GIT_REPO_URL="https://yourgitusername:[email protected]/example-user/example-repo.git" \
-e GIT_BRANCH="main" \
--name my-static-site \
meeaehlabs/static-site:latest
To test or use on a pre-production environment use tag 'test' this will pull updates once a minute
Automate with Webhooks
deploy the image as a stack/swarm with either the tags 'host & 'webhook' for a simple webhook that triggers the update from your repo or use 'host' & 'hookey' for a webhook that requires a secret you can set with the ENV Variable 'WEBHOOK_KEY' below is example of both and how to deploy them.
With a secret
version: '3.9'
services:
webhook:
container_name: site-webhook-keyed
image: meeaehlabs/static-site:hookey
environment:
- GIT_REPO=${GIT_REPO} # e.g., https://github.com/username/repo.git
- GIT_BRANCH=${GIT_BRANCH} # e.g., main
- WEBHOOK_KEY=${WEBHOOK_KEY} # the secret and webhook url will be shown in the container logs when it first starts up
volumes:
- site-content:/site-content
ports:
- "5000:5000" # Exposes the webhook endpoint
host:
container_name: site-host
image: meeaehlabs/staticsite:host
volumes:
- site-content:/usr/share/nginx/html:ro
ports:
- "80:80" # Exposes the static website
volumes:
site-content:
Without a secret
version: '3.9'
services:
webhook:
container_name: site-webhook-NoKey
image: meeaehlabs/static-site:webhook
environment:
- GIT_REPO=${GIT_REPO} # e.g., https://github.com/username/repo.git
- GIT_BRANCH=${GIT_BRANCH} # e.g., main
volumes:
- site-content:/site-content
ports:
- "5000:5000" # Exposes the webhook endpoint
host:
container_name: site-host
image: meeaehlabs/staticsite:host
volumes:
- site-content:/usr/share/nginx/html:ro
ports:
- "80:80" # Exposes the static website
volumes:
site-content:
docker pull meeaehlabs/static-site:latest