Skip to content

Commit

Permalink
Add mongodb environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
3xjn committed Oct 15, 2024
1 parent 3e8cfe7 commit f9909ab
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/digitalocean-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,19 @@ jobs:
ssh-keyscan -H ${{ secrets.DROPLET_IP }} >> ~/.ssh/known_hosts
- name: SSH into Droplet and Deploy using Docker
env:
MONGO_CONNECTION_STRING: ${{ secrets.MONGO_CONNECTION_STRING }}
MONGO_COLLECTION_NAME: ${{ secrets.MONGO_COLLECTION_NAME }}
MONGO_DATABASE_NAME: ${{ secrets.MONGO_DATABASE_NAME }}
run: |
ssh -o ServerAliveInterval=60 -o ServerAliveCountMax=10 -i ~/.ssh/id_rsa ${{ secrets.DROPLET_USERNAME }}@${{ secrets.DROPLET_IP }} << EOF
echo $GITHUB_PAT | docker login ghcr.io -u 3xjn --password-stdin
echo ${{ secrets.PAT }} | docker login ghcr.io -u 3xjn --password-stdin
docker stop my-todo-app || true && docker rm my-todo-app || true
docker pull ghcr.io/${{ env.REPO_NAME }}/my-container:latest
docker run -d --name my-todo-app \
-p 8080:8080 \
-e Mongo__ConnectionString="$MONGO_CONNECTION_STRING" \
-e Mongo__CollectionName="$MONGO_COLLECTION_NAME" \
-e Mongo__DatabaseName="$MONGO_DATABASE_NAME" \
ghcr.io/${{ env.REPO_NAME }}/my-container:latest
EOF
EOF

0 comments on commit f9909ab

Please sign in to comment.