OVERVIEW

This guide will walk you through different strategies for automating the deployment of your custom docker images to a ComputeStacks instance.

SECTIONS


Using a Makefile

This makefile uses an environmental variable to store your ComputeStacks API credentials. If you will be running this from your local computer, I recommend using a tool such as direnv to manage your environmental variables.

ComputeStacks Authentication

Generate your API credentials from within the ComputeStacks interface and make them available to your local shell.

  1. Using direnv
cd ~/my-project && echo 'export COMPUTESTACKS_AUTH_KEY="MY-CS-API-KEY:MY-CS-API-SEDCRET"' >> ~/.envrc
direnv allow .
  1. Without any tool
export COMPUTESTACKS_AUTH_KEY="MY-CS-API-KEY:MY-CS-API-SEDCRET"

Create your Makefile

Replace [<https://my.computestacks.com/api/container_services/100/power/rebuild>](<https://my.computestacks.com/api/container_services/100/power/rebuild>) with the URL of your ComputeStacks installation, and 100 with the ID of your container service. You can easily find this by navigating to the service overview page (Projects → My Project → My Service) and looking in the URL.

.PHONY: build help run push

help: ## Help
  @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\\033[36m%-30s\\033[0m %s\\n", $$1, $$2}' $(MAKEFILE_LIST)

.DEFAULT_GOAL := help

build: ## Build Image
  @docker build --progress plain -t my.registry.server/myimage:imagetag .

push: ## Deploy newly crated image
  @docker push my.registry.server/myimage:imagetag

deploy: ## Trigger rebuild of site
  @curl -X PUT -u "$(COMPUTESTACKS_AUTH_KEY)" -H "Content-Type: application/json" -H "Accept: application/json" <https://my.computestacks.com/api/container_services/100/power/rebuild>