Skip to content

Commit

Permalink
Merge pull request #9 from lokalise/PLATSD-188_ditto_to_ecr
Browse files Browse the repository at this point in the history
PLATSD-188 ditto to ECR
  • Loading branch information
bbcnt authored Jun 28, 2023
2 parents 6424003 + e6f45a9 commit 58ec84a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .pre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ jobs:
variable: DOCKER_PASSWORD
commands:
- docker login -u lokalise -p ${DOCKER_PASSWORD} reg.lokalise.work
- docker build -f docker/Dockerfile -t reg.lokalise.work/ce-connector-ditto/app:PRE-{{.PR}} .
- docker build -f docker/Dockerfile -t 053497547689.dkr.ecr.eu-central-1.amazonaws.com/ce-connector-ditto/app:PRE-{{.PR}} -t reg.lokalise.work/ce-connector-ditto/app:PRE-{{.PR}} .
- docker push reg.lokalise.work/ce-connector-ditto/app:PRE-{{.PR}}
- docker push 053497547689.dkr.ecr.eu-central-1.amazonaws.com/ce-connector-ditto/app:PRE-{{.PR}}

- name: deploy-{{.PR}}
node: ditto-{{.PR}}
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
services:
app:
image: reg.lokalise.work/ce-connector-ditto/app:${TAG}
image: 053497547689.dkr.ecr.eu-central-1.amazonaws.com/ce-connector-ditto/app:${TAG}
13 changes: 13 additions & 0 deletions docker/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ retag_and_push_image() {
docker push ${IMAGE}:latest
}

retag_and_push_image_ecr() {
IMAGE="${LOKALISE_ECR_REGISTRY}/${GIT_REPO_NAME}/${APP_NAME}"

log "Retaging ECR image with ${IMAGE}:${TAG}"

docker pull ${IMAGE}:PRE-${GIT_BASE_BRANCH}
docker tag ${IMAGE}:PRE-${GIT_BASE_BRANCH} ${IMAGE}:${TAG}
docker tag ${IMAGE}:PRE-${GIT_BASE_BRANCH} ${IMAGE}:latest
docker push ${IMAGE}:${TAG}
docker push ${IMAGE}:latest
}

create_git_release() {
curl -s -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
Expand Down Expand Up @@ -93,6 +105,7 @@ case ${action} in
git_tag)
create_git_tag
retag_and_push_image
retag_and_push_image_ecr
;;
git_release)
create_git_release
Expand Down
1 change: 1 addition & 0 deletions docker/scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -o pipefail
REQUIRED_EXECUTABLES=(curl docker docker-compose jq vault)
DOCKER_ROOT_PATH=${DOCKER_ROOT_PATH:-docker}
LOKALISE_REGISTRY="reg.lokalise.work"
LOKALISE_ECR_REGISTRY="053497547689.dkr.ecr.eu-central-1.amazonaws.com"
REGISTRY_USER="lokalise"


Expand Down

0 comments on commit 58ec84a

Please sign in to comment.