Skip to content

Commit

Permalink
complete
Browse files Browse the repository at this point in the history
  • Loading branch information
box-genius committed Jul 5, 2024
1 parent 12b34c7 commit de4fc57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Verificar Instalação do Docker
name: projeto automatizado completo etapa 3 cicd deploy aplicacao

on:
push:
branches:
- main

jobs:
verify_docker:
deploy:
runs-on: ubuntu-latest
steps:
- name: Fazer checkout do repositório
Expand Down Expand Up @@ -49,13 +49,6 @@ jobs:
echo "Instance IDs: ${{ env.instance_ids }}"
echo "Instance Public IPs: ${{ env.instance_public_ips }}"
- name: Verificar Instalação do Docker
run: |
for ip in $(echo ${{ env.instance_public_ips }} | tr "," "\n"); do
echo "Verificando Docker na instância $ip"
ssh -o StrictHostKeyChecking=no -i /path/to/your/private/key ubuntu@$ip "docker --version"
done
# - name: Destruir Terraform
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
10 changes: 8 additions & 2 deletions Terraform_IaC/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ resource "aws_instance" "web" {
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
if [ $? -eq 0 ]; then
echo "Docker installed successfully" > /var/log/docker-install.log
else
echo "Docker installation failed" > /var/log/docker-install.log
fi
sudo usermod -aG docker ubuntu
sudo systemctl enable docker
sudo systemctl start docker
docker --version > /var/log/docker-version.log
EOF
}
}

0 comments on commit de4fc57

Please sign in to comment.