Skip to content

Added deployment 16 #21

Added deployment 16

Added deployment 16 #21

Workflow file for this run

name: Deployment
on:
push:
branches:
- deploy2
jobs:
app_deployment:
runs-on: ubuntu-latest
env:
IMAGE_VERSION: "1123"
IMAGE_USERNAME: theoafactor
steps:
- name: 'Checkout the repo'
uses: actions/checkout@v4
- name: "Build an image"
run: |
docker build -t theoafactor/booksfinder:1123 .
- name: 'Log into Docker'
run: |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
- name: "Push the image to Docker Hub"
run: |
docker push theoafactor/booksfinder:1123
- name: "SSH into EC2 instance"
env:
SSH_KEY: ${{ secrets.EC2_PRIVATE_KEY }}
run: |
echo "$SSH_KEY" > ssh_key && chmod 600 ssh_key
ssh -o StrictHostKeyChecking=no -i ssh_key [email protected] '
sudo apt-get update &&
sudo apt-get install ca-certificates curl -y &&
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
'