Skip to content

ignore deploy.yml file and update docker file #1

ignore deploy.yml file and update docker file

ignore deploy.yml file and update docker file #1

Workflow file for this run

name: Deploy to Ubuntu Server
# Define when the workflow should run
on:
push:
branches:
- master # Trigger the workflow when code is pushed to the 'main' branch
# Define the jobs to run in the workflow
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# 1. Checkout the repository code
- name: Checkout code
uses: actions/checkout@v2
# 2. Set up Python to ensure dependencies are handled if needed
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11.9'
# 3. Install project dependencies (requirements.txt)
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build Docker images
run: docker-compose build
- name: Save Docker images as tar files
run: |
docker save -o smart_trader_app.tar smart-trader-app
docker save -o celery_app.tar celery
docker save -o nginx_app.tar nginx
docker save -o redis_app.tar redis:7.0.12
- name: Copy tar files to server
uses: appleboy/[email protected]
with:
host: 10.0.0.80
username: vision
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: "*.tar"
target: "/home/vision/"
- name: SSH and load Docker images
uses: appleboy/[email protected]
with:
host: 10.0.0.80
username: vision
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
docker load -i /home/vision/smart_trader_app.tar
docker load -i /home/vision/celery_app.tar
docker load -i /home/vision/nginx_app.tar
docker load -i /home/vision/redis_app.tar
cd /home/vision/smart-trader-app
docker-compose up -d