minor #10
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: ai_trader | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'README.md' | |
jobs: | |
automated_trading: | |
# runs-on: ubuntu-latest | |
runs-on: self-hosted | |
env: | |
ALPACA_API_KEY : ${{secrets.ALPACA_API_KEY}} | |
ALPACA_SECRET_KEY : ${{secrets.ALPACA_SECRET_KEY}} | |
ALPACA_API_BASE_URL : ${{secrets.ALPACA_API_BASE_URL}} | |
ALPACA_PAPER : ${{secrets.ALPACA_PAPER}} | |
steps: | |
# Step 1: Checkout the code from the repository | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Step 2: Set up Docker | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
# Step 3: Build Docker image | |
- name: Build Docker image | |
run: | | |
docker build -t ai_trader . | |
# Step 4: write .env | |
- name: Write env file | |
run: | | |
echo "ALPACA_API_KEY=${ALPACA_API_KEY}" >> .env | |
echo "ALPACA_SECRET_KEY=${ALPACA_SECRET_KEY}" >> .env | |
echo "ALPACA_API_BASE_URL=${ALPACA_API_BASE_URL}" >> .env | |
echo "ALPACA_PAPER=${ALPACA_PAPER}" >> .env | |
# Step 5: Run the container (if GPU is required, you can add optional GPU support here) | |
- name: Run AI Trader | |
run: | | |
docker run --gpus all -p 8501:8501 -v $(pwd):/app ai_trader /bin/sh -c "cd /app && python main.py" | |