Skip to content

Commit

Permalink
Experimenting with variables 6
Browse files Browse the repository at this point in the history
  • Loading branch information
theoafactor committed Dec 9, 2024
1 parent 783c9cc commit d3dc794
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,49 +31,51 @@ jobs:
echo ${{ steps.get-version.outputs.version }}
# app_deployment:
# runs-on: ubuntu-latest
# env:
# IMAGE_VERSION: "1123"
# IMAGE_USERNAME: theoafactor
# steps:
# - name: 'Checkout the repo'
# uses: actions/checkout@v4
app_deployment:
runs-on: ubuntu-latest
needs:
- generate_id
env:
VERSION: ${{ needs.generate_id.outputs.version }}
steps:
- name: 'Checkout the repo'
uses: actions/checkout@v4

# - name: "Build an image"
# run: |
# docker build -t theoafactor/booksfinder:1124 .
- name: "Build an image"
run: |
docker build -t theoafactor/booksfinder:${{ needs.generate_id.outputs.version }} .
# - name: 'Log into Docker'
# run: |
# docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
- 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:1124
- name: "Push the image to Docker Hub"
run: |
docker push theoafactor/booksfinder:${{ needs.generate_id.outputs.version }}
# - 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] '
- 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] version=$( echo ${{ needs.generate_id.outputs.version }} ) '
# 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 &&
# 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 &&
# sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y &&
# sudo docker stop $( sudo docker ps -a -q ) &&
# sudo docker rm $( sudo docker ps -a -q ) &&
# sudo docker rmi $( sudo docker images -q ) &&
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 &&
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 &&
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y &&
sudo docker stop $( sudo docker ps -a -q ) &&
sudo docker rm $( sudo docker ps -a -q ) &&
sudo docker rmi $( sudo docker images -q ) &&
# sudo docker pull theoafactor/booksfinder:1124 &&
# sudo docker run -d -p 80:80 theoafactor/booksfinder:1124
sudo docker pull theoafactor/booksfinder:$version &&
sudo docker run -d -p 80:80 theoafactor/booksfinder:$version
# '
'

0 comments on commit d3dc794

Please sign in to comment.