Skip to content

This is a template for deploying Portainer stacks GitHub Actions. It uses Portainer webhooks for automatic stack updates.

Notifications You must be signed in to change notification settings

inputstudio/portainer-stack-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Portainer stack deployment template

This is a template for deploying Portainer stacks with GitHub Actions.

Note: Using Portainer webhooks requires Portainer Business Edition. You can get a free license here.

Features

  • 🐋 GitHub Actions workflow to build and push the image to whatever registry you want (defaults to ghcr.io)
  • 🪝 Webhook to automatically update the stack on Portainer

Usage

  1. Download the deploy.yml and move it to the .github/workflows folder:
curl -LJO https://raw.githubusercontent.com/inputstudio/portainer-stack-template/main/.github/workflows/deploy.yml

If you don't have curl installed, you can open the link above and copy the content to a new file named deploy.yml in the .github/workflows folder.

  1. Edit deploy.yml replacing ghcr.io/inputstudio/hello-world with your image name.

  2. Create your Dockerfile and compose.yml or use docker init:

docker init
  1. (optional) If you want to use environment variables in your stack, add the following to your compose.yml:
services:
  my-service:
    env_file:
      - stack.env # This file contains all the environment variables set in the stack editor
  1. Add a stack on Portainer and enable GitOps webhook.
  2. Add the webhook URL to your GitHub repo secrets as PORTAINER_STACK_WEBHOOK.
  3. Done 🎉

About

This is a template for deploying Portainer stacks GitHub Actions. It uses Portainer webhooks for automatic stack updates.

Topics

Resources

Stars

Watchers

Forks