← Back to index

Docker Template

Build Docker images, push to a registry, and deploy via SSH, ECS, ACA, or Kubernetes.

Setup

Recommended: External CI/CD Configuration

Go to Settings > CI/CD > General pipelines and set CI/CD configuration file to:

https://gitlab-ci-yaml-template.enouvo.com/docker/.gitlab-ci.yml

Alternative: Include in .gitlab-ci.yml

include:
  - 'https://gitlab-ci-yaml-template.enouvo.com/docker/.gitlab-ci.yml'

Required Variables

GITLAB_CI_ACCESS_TOKENToken to download ci-scripts (set by admin at group level)
DOCKER_REGISTRYRegistry URL (e.g. gitlab.enouvo.com:5050)
DOCKER_REGISTRY_USERNAMERegistry username
DOCKER_REGISTRY_PASSWORDRegistry password
DOCKER_CONTAINER_PORTPort your app listens on

Optional Variables

VariableDefaultDescription
DOCKER_CPU_LIMIT0.5CPU limit for container
DOCKER_MEMORY_LIMIT512mMemory limit
DOCKER_FILE_PATHDockerfilePath to Dockerfile
DOCKER_BUILD_ARGSComma-separated build args
DOCKER_COMPOSE_ENABLEDfalseUse docker-compose build

Deploy Types

SSH (default)

Deploys via Docker remote daemon over SSH. Set DOCKER_HOST and TLS certs per environment.

Kubernetes

Set DOCKER_DEPLOY_TYPES=k8s and configure:

VariableDescription
KUBE_CONFIGBase64-encoded kubeconfig
K8S_DEPLOYMENT_HOSTIngress hostname
K8S_DEPLOYMENT_CONTAINER_PORTContainer port
K8S_DEPLOYMENT_REPLICASNumber of replicas (default: 1)
K8S_DEPLOYMENT_CONTAINER_VOLUME_MOUNT_PATHSingle NFS volume mount path
K8S_DEPLOYMENT_CONTAINER_VOLUME_MOUNT_PATHSMultiple mounts (comma-separated, e.g. /app/data:data,/app/workspace:workspace)
K8S_DEPLOYMENT_SECURITY_CONTEXT_FS_GROUPGID for volume ownership

ECS

Set DOCKER_DEPLOY_TYPES=ecs and configure AWS credentials + ECS variables.

Azure Container Apps

Set DOCKER_DEPLOY_TYPES=aca and configure Azure credentials.

Skip Variables

Skip specific stages per environment:

SKIP_DEV_BUILD=true
SKIP_STAGING_DEPLOY=true
SKIP_RELEASE_TEST=true

Pipeline Stages

testbuildscandeploynotify