File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,4 +30,5 @@ COPY . .
3030ENV PYTHONPATH /app/packages
3131
3232
33+ ENTRYPOINT ["python" ]
3334CMD ["main.py" ]
Original file line number Diff line number Diff line change 1+ steps :
2+ # Build the container image
3+ - name : ' gcr.io/cloud-builders/docker'
4+ args :
5+ - ' build'
6+ - ' -t'
7+ - ' us-central1-docker.pkg.dev/$PROJECT_ID/dcubabot/dcubabot:latest'
8+ - ' .'
9+
10+ # Push the container image to Artifact Registry
11+ - name : ' gcr.io/cloud-builders/docker'
12+ args :
13+ - ' push'
14+ - ' us-central1-docker.pkg.dev/$PROJECT_ID/dcubabot/dcubabot:latest'
15+
16+ # Deploy the main service to Cloud Run
17+ - name : ' gcr.io/google.com/cloudsdktool/cloud-sdk'
18+ entrypoint : gcloud
19+ args :
20+ - ' run'
21+ - ' deploy'
22+ - ' dcubabot'
23+ - ' --image=us-central1-docker.pkg.dev/$PROJECT_ID/dcubabot/dcubabot:latest'
24+ - ' --platform=managed'
25+ - ' --region=us-central1'
26+ - ' --allow-unauthenticated'
27+ - ' --port=8080'
28+
29+ # Deploy the scheduled job for updating groups
30+ - name : ' gcr.io/google.com/cloudsdktool/cloud-sdk'
31+ entrypoint : gcloud
32+ args :
33+ - ' run'
34+ - ' jobs'
35+ - ' deploy'
36+ - ' dcubabot-update-groups'
37+ - ' --image=us-central1-docker.pkg.dev/$PROJECT_ID/dcubabot/dcubabot:latest'
38+ - ' --region=us-central1'
39+ - ' --command=python'
40+ - ' --args=cron.py'
41+ - ' --schedule=0 0 * * *' # Daily at midnight
42+ - ' --time-zone=America/Argentina/Buenos_Aires'
Original file line number Diff line number Diff line change 1+ import asyncio
2+ import os
3+ import logging
4+ from telegram .ext import Application
5+ from bot_logic import _update_groups
6+
7+ def main ():
8+ """Runs the update_groups command."""
9+ logging .basicConfig (
10+ level = logging .INFO ,
11+ format = '[%(asctime)s] - [%(name)s] - [%(levelname)s] - %(message)s' ,
12+ )
13+
14+ application = Application .builder ().token (os .environ ["TELEGRAM_BOT_TOKEN" ]).build ()
15+
16+ async def run_update ():
17+ await _update_groups (application )
18+
19+ asyncio .run (run_update ())
20+
21+ if __name__ == "__main__" :
22+ main ()
You can’t perform that action at this time.
0 commit comments