Below are GitLab CI and Bitbucket Pipelines configurations for authenticating and pushing/pulling Docker images from Esadax’s private container registry.
Add the following to your .gitlab-ci.yml:
stages:
- build
- deploy
variables:
DOCKER_REGISTRY: esadax-registry.esadax.sh
IMAGE_NAME: my-project/my-app
before_script:
- echo "$Esadax_REGISTRY_TOKEN" | docker login $DOCKER_REGISTRY -u "$Esadax_USERNAME" --password-stdin
build_image:
stage: build
script:
- docker build -t $DOCKER_REGISTRY/$IMAGE_NAME:latest .
- docker push $DOCKER_REGISTRY/$IMAGE_NAME:latest
Set these in Settings > CI/CD > Variables:
Esadax_USERNAME: Your Esadax registry usernameEsadax_REGISTRY_TOKEN: Your personal or automation tokenAdd this to your bitbucket-pipelines.yml:
image: docker:20.10.7
pipelines:
default:
- step:
name: Build & Push to Esadax Registry
services:
- docker
caches:
- docker
script:
- echo $Esadax_REGISTRY_TOKEN | docker login esadax-registry.esadax.sh -u $Esadax_USERNAME --password-stdin
- docker build -t esadax-registry.esadax.sh/my-project/my-app:latest .
- docker push esadax-registry.esadax.sh/my-project/my-app:latest
Set the following under Repository Settings > Repository Variables:
Esadax_USERNAME: Your registry usernameEsadax_REGISTRY_TOKEN: Your secure token⚠️ Note: For Bitbucket, make sure to enable Docker support and include the
dockerservice.
:dev, :staging, :prod).build-push-action for GitHub Actions as an alternative approach.