feat(tls): add docker-compose with certbot to renewl tls certificates… #4
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
name: Deploy Explorer | |
on: | |
push: | |
branches: [ "atleta" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
- name: Create Image Tarball for Explorer | |
run: | | |
docker build -t sportchain-explorer -f docker/Dockerfile . | |
docker save -o sportchain-explorer.tar sportchain-explorer | |
mkdir -p artifacts/ | |
mv sportchain-explorer.tar artifacts/ | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
touch ~/.ssh/known_hosts | |
ssh-keyscan ${{ secrets.EXPLORER_HOST }} >> ~/.ssh/known_hosts | |
echo "${{ secrets.EXPLORER_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
eval $(ssh-agent) | |
- name: Copy Files to Server | |
run: | | |
scp artifacts/sportchain-explorer.tar ${{ secrets.EXPLORER_USERNAME}}@${{ secrets.EXPLORER_HOST }}:/sportchain/ | |
scp docker-compose.yaml ${{ secrets.EXPLORER_USERNAME}}@${{ secrets.EXPLORER_HOST }}:/sportchain/docker-compose.yaml | |
- name: SSH into Server and Deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.EXPLORER_HOST }} | |
username: ${{ secrets.EXPLORER_USERNAME }} | |
key: ${{ secrets.EXPLORER_PRIVATE_KEY }} | |
script: | | |
cd /sportchain | |
docker load -i sportchain-explorer.tar | |
docker compose up -d |