Docker: Configure the environment variables and secrets

This documentation is part of the Deploy with GitHub Actions guide. View the full guide here: Learn how to deploy your Docker containers using GitHub Actions.

Welcome to the Stackhero documentation

Stackhero provides 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. There is no extra setup: just start your containers.
  • Pick your own domain name, secured automatically with HTTPS (for example: https://api.your-company.com, https://www.your-company.com, or https://backoffice.your-company.com).
  • Benefit from strong performance and robust security on private, dedicated infrastructure.
  • Apply updates with one click for simple, low-effort maintenance.

You can have your containers live in production in about five minutes. Stackhero manages the infrastructure, updates, and security for you, so you can focus on delivering your applications. Read more about Docker CaaS cloud hosting.

To let GitHub Actions connect to your Stackhero Docker service, you will need two pieces of information: the domain name of your service 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, type "production" and confirm.

    Setting the environmentSetting the environment

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

    Setting environment restrictionsSetting environment restrictions

  5. Click Add deployment branch or tag rule, enter "production" in the Name pattern field, and 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 can find this endpoint in your Stackhero dashboard.

    Setting the endpoint variableSetting the endpoint variable

If you have customized 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 customizations, you can skip this section.

By default, GitHub Actions will look for the docker-compose.yml file in your project's root directory. If you need to use a different file or setup, 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 to:

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