Containerization - green-ecolution/backend GitHub Wiki

The Green Ecolution Backend can be run as a Docker container. The prebuilt image is available in the GitHub Container Registry (GHCR) and can be pulled using the following command:

docker pull ghcr.io/green-ecolution/green-ecolution-backend:latest

To start the container, run:

docker run -d -p 3000:3000 --name green-ecolution-backend ghcr.io/green-ecolution/green-ecolution-backend:latest

This will launch the container in the background, making it accessible via port 3000.

Dockerfile Overview

The Docker image follows a multi-stage build strategy to efficiently containerize the application:

  • Preparer Stage: Installs dependencies and sets up the build environment.
  • Builder Stage: Compiles the executable using make build.
  • Runner Stage: Copies the built binary into a lightweight Alpine Linux image, sets necessary environment variables, and starts the service.

Additional configurations can be modified in the config.default.yaml file located at .docker directory.