Skip to content

Commit

Permalink
cicd: add build and run
Browse files Browse the repository at this point in the history
  • Loading branch information
Emyr298 committed Jun 7, 2024
1 parent afa622b commit d5aa4fe
Showing 1 changed file with 27 additions and 31 deletions.
58 changes: 27 additions & 31 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,30 @@ jobs:
run: |
mkdir ./keys
echo '${{ secrets.CREDENTIALS }}' > ./keys/credentials.json
CHARACTER_COUNT=$(wc -c < ./keys/credentials.json)
echo "Character count: $CHARACTER_COUNT"
# - name: Checkout
# uses: actions/checkout@v3
# - name: Build Docker Image
# run: |
# docker build -t karirku-backend .
# - name: Save Docker Image as TAR File
# run: |
# docker save -o karirku-backend.tar karirku-backend
# - name: Send TAR File to Server
# uses: appleboy/[email protected]
# with:
# host: ${{ secrets.DEPLOYMENT_HOST }}
# username: ${{ secrets.DEPLOYMENT_HOST_USERNAME }}
# key: ${{ secrets.DEPLOYMENT_HOST_KEY }}
# port: 22
# source: karirku-backend.tar
# target: images/
# - name: Run Docker Image
# uses: appleboy/[email protected]
# with:
# host: ${{ secrets.DEPLOYMENT_HOST }}
# username: ${{ secrets.DEPLOYMENT_HOST_USERNAME }}
# key: ${{ secrets.DEPLOYMENT_HOST_KEY }}
# port: 22
# script: |
# docker container rm -f karirku-backend
# docker image rm -f karirku-backend
# docker load -i images/karirku-backend.tar
# docker run --name karirku-backend -d --restart always -p 8000:8000 karirku-backend
- name: Build Docker Image
run: |
docker build -t chefies-backend .
- name: Save Docker Image as TAR File
run: |
docker save -o chefies-backend.tar chefies-backend
- name: Send TAR File to Server
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOYMENT_HOST }}
username: ${{ secrets.DEPLOYMENT_HOST_USERNAME }}
key: ${{ secrets.DEPLOYMENT_HOST_KEY }}
port: 22
source: chefies-backend.tar
target: images/
- name: Run Docker Image
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOYMENT_HOST }}
username: ${{ secrets.DEPLOYMENT_HOST_USERNAME }}
key: ${{ secrets.DEPLOYMENT_HOST_KEY }}
port: 22
script: |
docker container rm -f chefies-backend
docker image rm -f chefies-backend
docker load -i images/chefies-backend.tar
docker run --name chefies-backend -e SERVICE_ACCOUNT_PATH="./keys/credentials.json" -d --restart always -p 8000:8000 chefies-backend

0 comments on commit d5aa4fe

Please sign in to comment.