Add scripts to rule them all

This commit is contained in:
Ian Adam Naval 2021-09-24 20:44:35 -04:00
parent 44abb6579d
commit 045fb59dbf
6 changed files with 81 additions and 13 deletions

View File

@ -1,22 +1,24 @@
ianonavy
========
# ianonavy
Source code for my personal website.
Requirements
------------
## Requirements
* Jekyll
- Docker
Installing
----------
## Getting started
Exact commands vary with OS.
See [Scripts to Rule Them All](https://github.com/github/scripts-to-rule-them-all)
1. Clone git repository.
2. Jekyll build.
```bash
script/server
```
Updating
--------
## Publish
To update, just run `git pull` in the repository.
```bash
script/cibuild
docker login
docker push ianonavy/ianonavy
kubectl rollout restart deploy/ianonavy
```

15
script/bootstrap Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# script/bootstrap: Resolve all dependencies that the application requires to
# run.
set -e
cd "$(dirname "$0")/.."
if [ -f "Dockerfile" ] && [ "$(uname -s)" = "Darwin" ]; then
docker version >/dev/null 2>&1 || {
echo 'Error: Install Docker for Desktop! Ensure "docker" is in your $PATH.'
exit 1
}
fi

17
script/cibuild Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# script/cibuild: Setup environment for CI to run tests. This is primarily
# designed to run on the continuous integration server.
#
# Since we don't have CI, this is used to locally build the Docker image for
# manually pushing to Dockerhub
set -e
cd "$(dirname "$0")/.."
script/bootstrap
echo "==> Building image…"
docker build -t ianonavy/ianonavy .

13
script/server Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# script/server: Launch the application and any extra required processes
# locally.
set -e
cd "$(dirname "$0")/.."
# ensure everything in the app is up to date.
script/update
docker run --rm -it -p 4000:4000 -v "$PWD/ianonavy:/srv/jekyll" jekyll/minimal:3.8 jekyll serve

12
script/setup Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# script/setup: Set up application for the first time after cloning, or set it
# back to the initial first unused state.
set -e
cd "$(dirname "$0")/.."
script/bootstrap
echo "==> App is now ready to go!"

9
script/update Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
# script/update: Update application to run for its current checkout.
set -e
cd "$(dirname "$0")/.."
script/bootstrap