Skip to contentSkip to conversation

building docker image in gitlab-ci

DISCUSSION Marek Marczykowski-Górecki 1 participant 1 message May 26, 2021

lore
Share & tools
lore
#0 lore raw

Hi,

Regarding our chat few minutes ago - this is part of the .gitlab-ci.yml, that builds and pushed containers, that is later used for other tests:

variables:
CONTAINER_TEST_IMAGE: ...

build:
stage: build
image: docker/compose:latest
services:
- docker:dind
script:
- cd ci
- docker-compose build
- docker tag <whatever-docker-compose-produced> $CONTAINER_TEST_IMAGE
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $CONTAINER_TEST_IMAGE

I use docker-compose here, but it doesn't really matter. It pushes to the container registry conveniently provided by gitlab too :)

In my case I build trigger it via push to a specific branch, but connecting to schedule should be trivial too.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab