-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
783c9cc
commit d3dc794
Showing
1 changed file
with
39 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
# ' | ||
' | ||