Created
July 14, 2022 04:07
-
-
Save taufiqpsumarna/5adc27643b7c4149dca303367030949a to your computer and use it in GitHub Desktop.
Simple example of CI to build a Docker container and push it to Amazon ECR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple example of CI to build a Docker container and push it to Amazon ECR | |
variables: | |
DOCKER_REGISTRY: 000000000000.dkr.ecr.eu-west-1.amazonaws.com | |
AWS_DEFAULT_REGION: eu-west-1 | |
APP_NAME: ecr_demo | |
DOCKER_HOST: tcp://docker:2375 | |
DOCKER_DRIVER: overlay2 | |
DOCKER_TLS_CERTDIR: "" | |
publish: | |
stage: build | |
image: | |
name: docker:latest | |
services: | |
- docker:19-dind | |
before_script: | |
- apk add --no-cache curl jq python3 py3-pip | |
- pip install awscli | |
- aws ecr get-login-password | docker login --username AWS --password-stdin $DOCKER_REGISTRY | |
- aws --version | |
- docker info | |
- docker --version | |
script: | |
- docker build -t $DOCKER_REGISTRY/$APP_NAME:$CI_PIPELINE_IID . | |
- docker push $DOCKER_REGISTRY/$APP_NAME:$CI_PIPELINE_IID | |
#Source https://devops.cisel.ch/push-your-docker-containers-from-gitlab-to-amazon-ecr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment