GitLab CI/CD

Build and push Docker Images with Gitlab CI

# .gitlab-ci.yml
build:
  stage: build
  image: docker:19.03.1
  services:
    - docker:dind
  before_script:
    - echo -n $CI_JOB_TOKEN | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY
  script:
    - docker build --pull -t "$CI_REGISTRY_IMAGE" .
    - docker push "$CI_REGISTRY_IMAGE"
  tags:
    - docker
 
# Dockerfile
FROM alpine:3.10
 
RUN apk add --no-cache nginx

Links
https://about.gitlab.com/2016/05/23/gitlab-container-registry/