Skip to content

update README

update README #24

Workflow file for this run

name: Deploy To EC2
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy to EC2
runs-on: ubuntu-latest
steps:
- name: Checkout the files
uses: actions/checkout@v3
- name: Copy files with SSH
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY }}
REMOTE_HOST: ${{ secrets.EC2_HOST }}
REMOTE_USER: ${{ secrets.EC2_USER }}
SOURCE: "./"
TARGET: "/home/ubuntu/ancine-database"
ARGS: "-rltgoDzvO --delete"
EXCLUDE: "/.git/, /.github/, /.gitignore, /venv/, /downloads/, **.env, **.env_template, /__pycache__/, /terraform/, /doc/"
- name: Check if Docker is installed & run it
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ubuntu
key: ${{ secrets.EC2_SSH_KEY }}
script: |
if ! command -v docker &> /dev/null
then
echo "Docker is not installed. Proceeding with installation."
sudo apt-get update -y
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update -y
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
else
echo "Docker is already installed."
fi
echo "Running Docker"
cd /home/ubuntu/ancine-database && sudo docker compose up -d --build