Skip to content
Snippets Groups Projects

GitLab CI/CD for Docker in Docker

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Michael Mäder
    Edited
    .gitlab-ci.yml 593 B
    build_flask_service:
      image: docker:19.03.13
      stage: build
      services:
        - docker:19.03.13-dind
      variables:
        IMAGE_TAG_SHA: "$CI_REGISTRY_IMAGE/calculator_app/image:$CI_COMMIT_SHORT_SHA"      
        IMAGE_TAG: "$CI_REGISTRY_IMAGE/calculator_app/image:latest"     
      script:    
        - cd mse_flask_web_site/    
        - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY   
        - docker pull $IMAGE_TAG || true 
        - docker build -t $IMAGE_TAG_SHA -t $IMAGE_TAG .    
        - docker push $IMAGE_TAG_SHA    
        - docker push $IMAGE_TAG
      before_script:
        - docker info
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment