Deployment

GitHub Actions

This project includes two GitHub Actions workflows, located in .github/workflows/api.yml and .github/workflows/ui.yml, each responsible for building, pushing, and deploying Docker images for the API and UI components. In both files we have only 2 jobs: build and deployment.


API Workflow (api.yml)

  • Workflow Name: [App] Your Name

  • Triggers: Executes on any push to the develop branch (can be production or stage, whatever you set) that includes changes in the api/ directory.

  • Environment: Staging

  • Key Steps:

    1. Checkout: Clones the repository.

    2. Docker Hub Login: Logs into Docker Hub using stored credentials.

    3. Docker Setup: Sets up Docker Buildx for multi-platform builds.

    4. Build and Push: Builds and pushes the Docker image using Dockerfile_api with the tag staging.

    5. Deployment: Triggers a POST request to initiate the deployment of the newly built image on the staging server.


UI Workflow (ui.yml)

  • Workflow Name: [App] Intercode Common UI Staging

  • Triggers: Executes on any push to the develop branch that includes changes in the ui/ directory.

  • Environment: Staging

  • Key Steps:

    1. Checkout: Clones the repository.

    2. Docker Hub Login: Logs into Docker Hub using stored credentials.

    3. Docker Setup: Sets up Docker Buildx for multi-platform builds.

    4. Build and Push: Builds and pushes the Docker image using Dockerfile_ui with the tag staging and necessary environment variables for the UI.

    5. Deployment: Triggers a POST request to initiate the deployment of the newly built image on the staging server.

Each workflow is designed for efficient staging deployment, with automated Docker image building and pushing, and deployment triggered through HTTP requests to a configured endpoint.

For correct work you should set necessary secrets and variables in your repository settings. In settings tab find Security module click on Secrets and variables and choose actions. To secrets add next variables with your values:

  • DOCKER_HUB_ACCESS_TOKEN

  • DOCKER_HUB_USERNAME

Then on tab "Variables" add next variables with your values:

  • DEPLOYMENT_HOST

  • DEPLOYMENT_PASSWORD

  • DEPLOYMENT_USERNAME

You can create Docker Hub account and necessary variables following next official guide:

To run deployment type next command in your production server terminal:

curl https://gist.github.com/YOUR-REPOSITORY-NAME/install.sh 
--ui-subdomain YOUR-DOMAIN --api-subdomain YOUR-DOMAIN

Last updated