HUB
Sign inSign up

meeaehlabs/static-site

By meeaehlabs

•Updated almost 2 years ago

A static Website hosting Image that auto-updates from Git Repo

Image
0

783

meeaehlabs/static-site repository overview

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:



Make sure to add the required ENV variables for your Git Repo (GIT_REPO) and Branch (GIT_BRANCH) and Webhook Key (WEBHOOK_KEY) which will act like a password to use the webhook if none is entered it will sert the default one ImNoTSeCUrE852!!

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:


Make sure to add the required ENV variables for your Git Repo (GIT_REPO) and Branch (GIT_BRANCH)
Tag summary
Recent tags
Content type
Image
Digest
sha256:7da7d36fc…
Size
23.8 MB
Last updated
almost 2 years ago
docker pull meeaehlabs/static-site:latest