Pull Ollama AI model in docker-compose.yml #22
This file contains hidden or 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: Rust + Docker CI | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:18.2 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: password | |
| POSTGRES_DB: bot_database | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres -d bot_database" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| env: | |
| DATABASE_URL: postgres://postgres:password@localhost:5432/bot_database | |
| RUST_BACKTRACE: full | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| profile: minimal | |
| - name: Install sqlx-cli | |
| run: cargo install sqlx-cli | |
| - name: Wait for Postgres | |
| run: | | |
| until pg_isready -h localhost -p 5432; do | |
| echo "Waiting for Postgres..." | |
| sleep 2 | |
| done | |
| - name: Run database migrations | |
| run: sqlx migrate run | |
| - name: Build | |
| run: cargo build --verbose --all-features | |
| - name: Run tests | |
| run: cargo test --verbose --all-features -- --nocapture | |
| - name: Create filler .env for Docker build | |
| run: | | |
| echo "DATABASE_URL=${DATABASE_URL}" > .env | |
| echo "BOT_TOKEN=dummy_token" >> .env | |
| - name: Build Docker image | |
| run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) |