This repository contains a reusable GitHub Actions workflow defined in the deploy.yml
file. This workflow can be used to deploy your application to different environments using Docker.
The workflow accepts the following inputs:
ENV
: The environment to deploy to (required).QEMU_ARCH
: The QEMU architecture to use (default:amd64
).DOWNLOAD_TASKFILE
: Whether to download the taskfile (default:true
).TASKFILE_VERSION
: The version of the deployer taskfile (default:main
).
The workflow accepts the following secrets:
ACTION_GITHUB_TOKEN
: GitHub token (optional).
To use this reusable workflow in your repository, create a new workflow file (e.g., .github/workflows/deploy.yml
) and include the following content:
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
uses: kalkanisys/workflow-docker/.github/workflows/deploy.yml@main
with:
ENV: "prod"
QEMU_ARCH: "amd64"
DOWNLOAD_TASKFILE: false
TASKFILE_VERSION: "main"
secrets:
ACTION_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SSH_KEY: ${{ secrets.PROD_SSH_KEY }}
KNOWN_HOSTS: ${{ secrets.PROD_KNOWN_HOSTS }}
This example triggers the deploy workflow on every push to the main
branch, deploying the application to the prod
environment.
To deploy your application on a remote server using docker-compose.deploy.yml
and deploy.yml
, follow these steps:
-
Download the Taskfile.yml: Ensure you have the
Taskfile.yml
in your project directory. -
Prepare
docker-compose.deploy.yml
: Create and configure thedocker-compose.deploy.yml
file with the containers you want to deploy. -
Create Environment-Specific Deploy Files: Create
deploy.{{ENV}}.yml
files with different variable values to customize your deployment. For example, you can setPROJECT
,REMOTE_HOST
, and other items as needed. -
Run the Deployment Task: Execute the deployment task with the appropriate environment variable.
ENV={{ENV}} task deploy
This command will use the Taskfile.yml
to deploy your application based on the specified environment configuration.