Script and configuration for standing up a Docker host. This includes Docker, multiple configured stacks, and a self-hosted GitHub Actions Runner.
Right now, installation supports CentOS 7 and Red Hat 9 (which also works with RHEL lookalikes such as Rocky Linux). Actual Docker installation is handled by the installation script, but you can use the stacks installer on any *nix machine, including macOS, by running stacks/setup.sh.
Login as root and execute:
source <(curl -H 'Cache-Control: no-cache, no-store' -o- https://raw.githubusercontent.com/uicpharm/docker-host/main/init.sh)
The script will download the project and walk you through executing the scripts.
If you cannot login as root and can only sudo, then download it to your home directory and execute it from there:
curl -H 'Cache-Control: no-cache, no-store' -o- https://raw.githubusercontent.com/uicpharm/docker-host/main/init.sh > init.sh && \
chmod +x init.sh && \
sudo ./init.sh
For more documentation about the stacks, please view the stacks readme.
For all environments, a deploy
script is installed in the system that helps with
deploying applications that use the docker-host environment. They provide a
docker-compose stack and any additional required files (.env
file, etc), and then
deploy with this script.
It takes these standard steps for deployment of UIC Pharmacy stacks:
- Login to your Docker repo
- Stop the application if it is currently running
- Create a pod (if using podman)
- Start up the stack using the stack path you provide
- Install the stack as a service (if using podman)
Example:
deploy production.yml
This will automatically deploy the application and install it as a service named
prior-auth-drug-search-production
, if you are running a podman
system.
Note if you are using an environment file named something other than .env
, you must
pass it to the script as well:
deploy production.yml --env-file=production.env
The deploy script can handle upgrades as well. Just pass the --upgrade
flag to ensure
it handles pulling fresh container images:
deploy production.yml --upgrade
For all environments, the publish
script helps with building and publishing container
images from your workstation to our container registry. It builds the image using the UIC
Pharmacy standards, such as:
- Uses semantic versioning based on the
version
defined inpackage.json
, including intelligent re-tagging of major versions. For instance, version1.2.3
will also tag versions1
and1.2
, however a prerelease like1.2.3-beta.1
will not. - Automatically adds the image to the correct repo as long as its
homepage
is set inpackage.json
. - Creates a multi-arch manifest, so images are built for Intel and Apple Silicon architectures.
- Automatically finds the context and
package.json
by assuming they're in the same directory as the Dockerfile.
Since podman and buildah do not support non-native architecture builds (i.e. building for arm64 in an amd64 environment), this script will force building only for your native architecture when it runs in a podman environment.
You can build and publish the image for a project with a single Dockerfile by just referencing the Dockerfile in the command:
# For project 'foo', creates image 'ghcr.io/uicpharm/foo':
publish path/to/Dockerfile
If you have a project with multiple Docker files, build them one at a time, assigning an additional name that can be appended to the image.
# For project 'foo', creates image 'ghcr.io/uicpharm/foo/bar':
publish path/to/Dockerfile.bar --name=bar
If you want to make sure it's working without actually publishing, here are some things you could do to check it:
--dry-run
will show you the commands that will run, without actually running them.
--no-push
will build the images but not push them to the registry.
--verbose
will show you a summary of all the settings that will be used for the build
and publishing process.
If you've installed the GitHub Runner service and now you want to remove it, you can do so by following these steps:
As root
:
cd /home/github/runner
./svc.sh stop
./svc.sh uninstall
Then, as the github
user:
cd ~/runner
./config.sh remove --token your-token-supplied-by-github