version: 0.2 phases: pre_build: commands: - set -e - ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) - REPOSITORY_URI=${ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/forgejo-repository - aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${REPOSITORY_URI} - GIT_TAG=$(date +%s) build: commands: - set -e - docker build -t ${REPOSITORY_URI}:${GIT_TAG} -t ${REPOSITORY_URI}:latest . post_build: commands: - set -e - docker push ${REPOSITORY_URI}:${GIT_TAG} - docker push ${REPOSITORY_URI}:latest - printf '[{"name":"forgejo","imageUri":"%s"}]' $REPOSITORY_URI:$GIT_TAG > imagedefinitions.json artifacts: files: imagedefinitions.json