Skip to main content

CI/CD

Overview

This guide explains the process of building, deploying, and serving your application using Docker, NGINX, GitHub Actions, and Nomad.

Dockerfile

  • Purpose: Creates a containerized version of your application.
  • Port Exposure: Exposes the application on port 13012.

NGINX

  • Serving: Serves the application to web browsers.
  • Configuration: Listens on port 13012 inside the container.
  • Static Files: Allows users to view static files within the Docker container.

GitHub Actions

First Action

  • Build: Creates the Docker image from the Dockerfile.
  • Push: Sends the image to DockerHub for version control.

Second Action

  • Pull: Retrieves the Docker image from DockerHub.
  • Deploy: Uses the image within job.nomad to deploy the application.

Nomad Configuration

job.nomad

  • Image Specification: Defines which Docker image to run.
  • Port Definition: Maps container ports to host ports for accessibility.

nomad.hcl

  • Server and Client Configuration: Sets up the Nomad server and client.
  • Network and Resources: Manages network interfaces and resource allocations.

Job.nomad as a Reverse Proxy

  • Port Mapping: Maps the container’s exposed port 13012 to the host machine’s port 13012.
  • Traffic Forwarding: Forwards traffic directed to port 13012 on the host machine to the container’s port 13012.

Summary

  1. Container: Application listens on port 13012.
  2. NGINX: Serves static files on port 13012 inside the container.
  3. Nomad: Ensures the internal port 13012 is accessible via the host’s port 13012, acting as a reverse proxy.