From c34cfbc3bb0c62ac925b131a36d9a81c6d8937e7 Mon Sep 17 00:00:00 2001 From: grensburg Date: Fri, 1 Dec 2023 10:41:33 +0100 Subject: [PATCH] deploy with ssh-action --- .github/workflows/deploy_testing.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_testing.yaml b/.github/workflows/deploy_testing.yaml index 3ccc138c..222e323b 100644 --- a/.github/workflows/deploy_testing.yaml +++ b/.github/workflows/deploy_testing.yaml @@ -99,8 +99,13 @@ jobs: key: ${{ secrets.TESTING_SSH_PRIVATE_KEY }} host: ${{ secrets.TESTING_SSH_HOST }} username: ${{ secrets.TESTING_USER_NAME }} - envs: DEPLOYMENT_NAME - script: echo "$DEPLOYMENT_NAME" > test.txt + envs: TESTING_ECR_REGISTRY, TESTING_ECR_REGISTRY_IMAGE + script: | + aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin "$TESTING_ECR_REGISTRY/$TESTING_ECR_REGISTRY_IMAGE" + docker pull "$TESTING_ECR_REGISTRY/$TESTING_ECR_REGISTRY_IMAGE:latest" + # stop and remove all containers + docker ps -aq | xargs docker stop | xargs docker rm + docker run -p 8000:8000 -d --env-file .env "$TESTING_ECR_REGISTRY/$TESTING_ECR_REGISTRY_IMAGE:latest"