Docker: Configure the environment variables and secrets

This documentation is part of the Deploy with GitHub Actions guide. You can view the complete guide here: Learn how to deploy your Docker containers using GitHub Actions.

Welcome to the Stackhero documentation

Stackhero offers a ready-to-use Docker cloud CaaS (Containers as a Service) platform, designed for fast and reliable container deployments:

  • Deploy to production with a single docker-compose up command. No additional configuration is required: simply start your containers.
  • Choose your own domain name, automatically secured with HTTPS (for example: https://api.your-company.com, https://www.your-company.com, or https://backoffice.your-company.com).
  • Benefit from high performance and enhanced security on private, dedicated infrastructure.
  • Apply updates with a single click for straightforward, effortless maintenance.

Your containers can be live in production in around five minutes. Stackhero manages the infrastructure, updates, and security for you, so you can focus on developing your applications. Find out more about Docker CaaS cloud hosting.

To allow GitHub Actions to connect to your Stackhero Docker service, you will need two pieces of information: your service's domain name and the certificates password.

  1. In the Stackhero dashboard, select your "production" Docker service and click the "Configure" button.

    Get service settingsGet service settings

  2. Copy both the "Domain name" and the "Docker certificates password" for use in the next steps.

    Get service settingsGet service settings

  1. In GitHub, open your project.

  2. Go to Settings > Environments, then click New environment.

    Configuring GitHub environmentsConfiguring GitHub environments

  3. In the Name field, enter "production" and confirm.

    Setting the environmentSetting the environment

  4. Click the No restriction button and select Selected branches and tags.

    Setting environment restrictionsSetting environment restrictions

  5. Click Add deployment branch or tag rule, enter "production" in the Name pattern field, then click Add rule.

    Setting environment branchSetting environment branch Setting environment branchSetting environment branch

  6. Under Environment secrets, click Add secret.

    Add secretAdd secret

  7. For the secret, use STACKHERO_CERTIFICATES_PASSWORD as the name and paste your certificates password into the Value field.

    Setting the certificates password secretSetting the certificates password secret

  8. Under Environment variables, click Add variable.

    Setting variablesSetting variables

  9. Use STACKHERO_ENDPOINT as the name and paste your Docker service endpoint into the Value field. You will find this endpoint in your Stackhero dashboard.

    Setting the endpoint variableSetting the endpoint variable

If you have customised your service's domain name, remember to use your custom domain instead of <XXXXXX>.stackhero-network.com.

If the docker-compose.yml file is already at the root of your project and you do not need any customisation, you can skip this section.

By default, GitHub Actions looks for the docker-compose.yml file at the root of your project. If you want to use a different file or configuration, you can adjust the deployment command. For example, if you are using our Getting started with Node.js and Docker boilerplate, you can create a new environment variable called STACKHERO_DEPLOY_COMMAND and set it as follows:

docker compose --env-file env.list --file docker/docker-compose.yml --file docker/docker-compose.production.yml up --build --remove-orphans -d