Skip to content

Commit

Permalink
(#1) adding the docker-hub deployment ci
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintAngeLs committed Mar 7, 2024
1 parent 80d8fd9 commit d14eb98
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/azure_synchronisation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
- name: Adding Azure DevOps remote repository
env:
AZURE_DEVOPS_USERNAME: ${{ secrets.AZURE_DEVOPS_USERNAME }} # Use the secret for the username
AZURE_DEVOPS_PASSWORD: ${{ secrets.AZURE_DEVOPS_PASSWORD }} # Use the secret for the password/PAT
AZURE_DEVOPS_USERNAME: ${{ secrets.AZURE_DEVOPS_USERNAME }}
AZURE_DEVOPS_PASSWORD: ${{ secrets.AZURE_DEVOPS_PASSWORD }}
run: |
git remote add azure https://$AZURE_DEVOPS_USERNAME:$AZURE_DEVOPS_PASSWORD@dev.azure.com/SocialAppOIPproject/SocialApp_IO/_git/SocialApp_IO
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/cloud_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy to Cloud

on:
push:
branches:
- project_setup

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

# - name: Set up SSH
# run: |
# mkdir -p ~/.ssh/
# echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
# chmod 600 ~/.ssh/id_rsa
# ssh-keyscan -H ${{ secrets.DROPLET_IP }} >> ~/.ssh/known_hosts
# cat ~/.ssh/known_hosts # Add this line to confirm that the key is added

- name: Check the structure
run: |
pwd
ls -la
- name: Docker Login
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Run dockerize_all.sh
run: |
chmod +x ./MiniSpace/scripts/dockerize-all.sh
./SwiftParcel/scripts/dockerize-all.sh
- name: Check the structure 2
run: |
pwd
ls -la
# - name: Test SSH Connection
# run: |
# ssh -vvv root@${{ secrets.DROPLET_IP }} "echo SSH Connection Successful"

# - name: Stop and Remove Containers
# run: |
# ssh root@${{ secrets.DROPLET_IP }} "docker ps -q --filter network=swiftparcel-network | xargs -r docker stop && docker ps -a -q --filter network=swiftparcel-network | xargs -r docker rm"

# - name: Clean up existing Cloud networks
# run: |
# ssh root@${{ secrets.DROPLET_IP }} "docker network rm swiftparcel-network || true"

# - name: Deploy to Cloud
# run: |
# scp -r ./SwiftParcel/d-docker-compose root@${{ secrets.DROPLET_IP }}:${{ secrets.CLOUD_PROJECT_PATH }}
# ssh root@${{ secrets.DROPLET_IP }} "cd ${{ secrets.CLOUD_PROJECT_PATH }}/SwiftParcel/d-docker-compose && docker-compose -f ${{ secrets.CLOUD_DEPLOYMENT_FILE }} pull && docker-compose -f ${{ secrets.CLOUD_DEPLOYMENT_FILE }} up -d --force-recreate"
2 changes: 2 additions & 0 deletions MiniSpace.Web/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
dotnet build -c release
11 changes: 11 additions & 0 deletions MiniSpace.Web/scripts/dockerize-tag-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

export ASPNETCORE_ENVIRONMENT=Development

cd MiniSpace.APIGateway

docker build -t minispace.web:latest .

docker tag minispace.web:latest adrianvsaint/minispace.web:latest

docker push adrianvsaint/minispace.web:latest
21 changes: 21 additions & 0 deletions MiniSpace.Web/scripts/dockerize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
TAG=''
VERSION_TAG=

case "$TRAVIS_BRANCH" in
"master")
TAG=latest
VERSION_TAG=$TRAVIS_BUILD_NUMBER
;;
"develop")
TAG=dev
VERSION_TAG=$TAG-$TRAVIS_BUILD_NUMBER
;;
esac

REPOSITORY=$DOCKER_USERNAME/pacco.services.identity

docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker build -t $REPOSITORY:$TAG -t $REPOSITORY:$VERSION_TAG .
docker push $REPOSITORY:$TAG
docker push $REPOSITORY:$VERSION_TAG
4 changes: 4 additions & 0 deletions MiniSpace.Web/scripts/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
export ASPNETCORE_ENVIRONMENT=local
cd src/MiniSpace.Services.Identity.Api
dotnet run
2 changes: 2 additions & 0 deletions MiniSpace.Web/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
dotnet test

0 comments on commit d14eb98

Please sign in to comment.