CosmoMyzrailGorynych / justdoit

A container image that watches a git repo, runs your build command and serves the product as a static site. Made for home-brew JAM-stack apps. Node.js-based.

Home Page:https://cosmomyzrailgorynych.github.io/justdoit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JUSTDOIT is a container for making home-brewn JAM-stack apps without bullshit. Kubernetes-friendly.

About

This image does the following:

  1. (Conditionally) adds a deploy key for your repo;
  2. Clones the repo;
  3. Runs a setup command specified by you (default is npm install);
  4. Runs a build command specified by you (or defaults to npm run build);
  5. Serves a static HTTP server on port 8080;
  6. Fetches the repo at a given interval and rebuilds your site if the repo changed.

Only a single branch is cloned, with the default number of commits of 10 (it fetches only a part of the history).

This image is based on node.js LTS image. It contains npm and yarn. Made with Podman.

Examples β¬… πŸ’ƒπŸ’…πŸŽ‰πŸ’ͺπŸ’¦

Getting the image

Alpine (recommended):

docker pull cosmomyzrailgorynych/justdoit:latest-alpine

Or vanilla:

docker pull cosmomyzrailgorynych/justdoit

Also see the repo at the Docker hub.

Environment variables

  • GIT_URL (required) β€” the URL to clone. For public repos, it can be anything supported by git clone. If you are using a private repo, a git@… URL with a deploy key is required.
  • GIT_DEPLOY_KEY β€” a private key that has read access to the repo at GIT_URL. It must be a string that has:
    1. its lines joined and split with literal \n;
    2. an additional \n at the end of it.
  • GIT_DEPLOY_PASSPHRASE β€” suits both as a potential passphrase and a password for git requests. Usually not needed at all; defaults to an empty string.
  • GIT_DEPLOY_FORMAT β€” rsa, ed25519 and such. Defaults to rsa. Sets the filename of a private key in the ~/.ssh directory.
  • GIT_DEPTH β€” the number of commits to fetch from the repo. Other commits will not be downloaded. Defaults to 10.
  • GIT_PULL_RATE β€” the duration of a pause between builds, in minutes. Defaults to 5 (five minutes). Fractional periods (like 1.5) can be used.
  • GIT_BRANCH β€” the branch to checkout. Other branches will not be downloaded. Defaults to master.

  • BUILD_SETUP β€” a shell script that will be executed once after a repo is cloned. Multiline strings (split with literal \n) will be split into separate sequential commands. Escaped lines (\\n) will be joined into one line.
  • BUILD_SCRIPT β€” a shell script that will be executed after a repo is cloned or successfully cloned. Behaves in the same way as BUILD_SETUP.
  • BUILD_TIMEOUT β€” Maximum time to wait for a build to finish, in minutes.
  • BUILD_AUTOWIPE β€” Whether or not the folder at SERVE_DIR should be removed before building the repo. Defaults to 1 (wipe); set to 0 to disable it.
  • BUILD_HOOK β€” a webhook. A secret URL on which any request triggers pulling a repo and rebuilding the site. The site will be rebuilt even if the repo is not changed. Can be any path with a starting slash without GET parameters.
  • BUILD_USE_SUBSTITUTE β€” whether to serve a copy of a built directory while building a new one. Strongly recommended for enabled BUILD_AUTOWIPE as it prevents 404 errors popping while files are being baked. Defaults to 1 (use a substitute).

  • SERVE_DIR β€” a directory inside your repo to serve. Defaults to ./dist.
  • SERVE_DOTFILES β€” 0 or 1 (default). Whether files with dots at the beginning of their name (like .gitignore) will be served.
  • SERVE_404 β€” a path to a file that will be served if a client opens an invalid URL. Defaults to 404.html. If the file is not found, a plain-text response will be given.

Checking the app's status

If syncing and building succeeded, the app will serve an endpoint /justdoitstatus.json. It will have {"ok":true} response. If the build/pulling was unsuccessful, there will be a 404 error.

Support

Eh.

Bugs & PRs

Send them to this repo. Making stuff for podman/docker/crio/whatever is the last thing I would usually do, so don't await for active maintenance. You get stuff for free without any warrancies.

About

A container image that watches a git repo, runs your build command and serves the product as a static site. Made for home-brew JAM-stack apps. Node.js-based.

https://cosmomyzrailgorynych.github.io/justdoit/

License:Do What The F*ck You Want To Public License


Languages

Language:JavaScript 81.2%Language:Dockerfile 12.2%Language:Shell 6.6%