Files
flowbite-beardedtek.com/.github/workflows/deploy.yml
BeardedTek fe11455103 remove DC_BUILD_FLAGS and DC_UP_FLAGS
Turn docker compose command into a variable and echo it prior to SSH'ing into server.
2025-04-18 13:24:26 -08:00

28 lines
812 B
YAML

name: Deploy to Remote Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Deploy with Docker Compose
env:
DEPLOY_KEY: ${{secrets.DEPLOY_KEY}}
REMOTE_HOST: ${{ secrets.REMOTE_HOST}}
REMOTE_USER: ${{ secrets.REMOTE_USER}}
DC_FILE: ${{ secrets.DOCKER_COMPOSE_FILE }}
run: |
mkdir -p ~/.ssh
echo "$DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H $REMOTE_HOST >> ~/.ssh/known_hosts
CMD="docker compose -f $DC_FILE build --no-cache && docker compose -f $DC_FILE up -d"
echo $CMD
ssh -i ~/.ssh/id_rsa $REMOTE_USER@$REMOTE_HOST $CMD