Skip to content

Commit

Permalink
correction de deploy.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainArd committed Jul 6, 2024
1 parent d6dfcfe commit 2b8cd31
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
distribution: 'adopt' # Vous pouvez aussi utiliser 'zulu' ou 'temurin' selon vos préférences

- name: Build with Maven
run: mvn clean package
Expand Down Expand Up @@ -48,14 +48,14 @@ jobs:
ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com
ECR_REPOSITORY: hello-world
IMAGE_TAG: ${{ github.sha }}
SSH_KEY_PATH: "C:\\Users\\Sylvain\\.ssh\\my-key-pair"
SSH_KEY_PATH: C:/Users/Sylvain/.ssh/my-key-pair
run: |
INSTANCE_IDS=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=backend-instance-*" --query "Reservations[*].Instances[*].InstanceId" --output text)
for INSTANCE_ID in $INSTANCE_IDS; do
PUBLIC_IP=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID --query "Reservations[*].Instances[*].PublicIpAddress" --output text)
echo "Connecting to $PUBLIC_IP"
ssh -o StrictHostKeyChecking=no -i "$SSH_KEY_PATH" ec2-user@$PUBLIC_IP <<EOF
aws ecr get-login-password --region us-east-1 | sudo docker login --username AWS --password-stdin $ECR_REGISTRY
ssh -o StrictHostKeyChecking=no -i $SSH_KEY_PATH ec2-user@$PUBLIC_IP <<EOF
$(aws ecr get-login-password --region us-east-1 | sudo docker login --username AWS --password-stdin $ECR_REGISTRY)
sudo docker pull $ECR_REGISTRY/$ECR_REPOSITORY:latest
sudo docker run -d -p 80:8080 $ECR_REGISTRY/$ECR_REPOSITORY:latest
EOF
Expand All @@ -73,7 +73,7 @@ EOF
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
distribution: 'adopt' # Vous pouvez aussi utiliser 'zulu' ou 'temurin' selon vos préférences

- name: Run tests with Maven
run: mvn test

0 comments on commit 2b8cd31

Please # to comment.