Skip to content

add docker install

add docker install #48

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
EC2_SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
EC2_URL: ${{ secrets.EC2_HOST }}
EC2_USERNAME: ${{ secrets.EC2_USER }}
GIT_PAT: ${{ secrets.GIT_PAT }}
if: github.head_ref == 'dev'
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Setup SSH for EC2
uses: omarhosny206/[email protected]
with:
EC2_SSH_PRIVATE_KEY: $EC2_SSH_PRIVATE_KEY
EC2_URL: $EC2_URL
# then you can run commands/scripts directly on the EC2 instance e.g.:a
- name: Remove app folder"
run: |
ssh -o StrictHostKeyChecking=no $EC2_USERNAME@$EC2_URL "rm -rf ~/testGha"
# Install docker & docker compose
- name: Install docker
run: |
ssh -o StrictHostKeyChecking=no $EC2_USERNAME@$EC2_URL "sudo yum update && sudo yum install docker"
- name: Add group membership for the default ec2-user
run: |
ssh -o StrictHostKeyChecking=no $EC2_USERNAME@$EC2_URL "sudo usermod -a -G docker ec2-user && id ec2-user && newgrp docker"
- name: Install docker-compose
run: |
ssh -o StrictHostKeyChecking=no $EC2_USERNAME@$EC2_URL "wget https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) && sudo mv docker-compose-$(uname -s)-$(uname -m) /usr/local/bin/docker-compose && sudo chmod -v +x /usr/local/bin/docker-compose"
- name: Enable docker service at AMI boot time
run: |

Check failure on line 49 in .github/workflows/prod.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/prod.yml

Invalid workflow file

You have an error in your yaml syntax on line 49
ssh -o StrictHostKeyChecking=no $EC2_USERNAME@$EC2_URL "sudo systemctl enable docker.service && sudo systemctl start docker.service"
- name: check Docker install
run: |
ssh -o StrictHostKeyChecking=no $EC2_USERNAME@$EC2_URL "sudo systemctl status docker.service"
- name: Install python3
run: |
ssh -o StrictHostKeyChecking=no $EC2_USERNAME@$EC2_URL "sudo apt install python3"
# Install git and clone repo
- name: Install git
run: |
ssh -o StrictHostKeyChecking=no $EC2_USERNAME@$EC2_URL "sudo apt install git"
- name: Set Git Username and Password
run: |
ssh -o StrictHostKeyChecking=no $EC2_USERNAME@$EC2_URL "git config --global user.name "dst" && git config --global user.password $GIT_PATH"
- name: Clone repo
run: |
git clone https://github.com/DstMlOpsCrypto/testGha.git