forked from shazforiot/nodeapp_test
-
Notifications
You must be signed in to change notification settings - Fork 1
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
6724901
commit a1d6e39
Showing
1 changed file
with
21 additions
and
10 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 |
---|---|---|
@@ -1,24 +1,35 @@ | ||
name: Docker Build and Run | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build_and_run: | ||
deploy: | ||
runs-on: self-hosted | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build Docker image | ||
- name: Decrypt credentials | ||
run: | | ||
docker build -t test_decrypt_credentials /home/mnagaraju/actions-runner/Testproject-inno/ | ||
# Path variables | ||
CREDENTIALS_ENC="/home/mnagaraju/actions-runner/Testproject-inno/credentials.enc" | ||
ENCRYPTION_KEY="/home/mnagaraju/actions-runner/Testproject-inno/encryption_key.txt" | ||
CREDENTIALS="/home/mnagaraju/actions-runner/Testproject-inno/credentials.txt" | ||
- name: Recreate Docker Container | ||
# Decrypt the credentials | ||
openssl enc -aes-256-cbc -pbkdf2 -d -in $CREDENTIALS_ENC -out $CREDENTIALS -pass file:$ENCRYPTION_KEY | ||
if [ $? -ne 0 ]; then | ||
echo "Decryption failed" | ||
exit 1 | ||
fi | ||
echo "Decryption succeeded" | ||
- name: Deploy with Docker Compose | ||
run: | | ||
docker stop test_decrypt_credentials || true | ||
docker rm test_decrypt_credentials || true | ||
docker run --name test_decrypt_credentials -d test_decrypt_credentials | ||
docker-compose -f /home/mnagaraju/actions-runner/Testproject-inno up -d |