diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..caf2d0c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.git +.dockerignore +.gitattributes +.gitignore +Dockerfile +LICENSE +README.md + diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..f444566 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,54 @@ +name: "Deployment" +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + deployment: + name: 🚀 GCP Deploy + runs-on: ubuntu-latest + + steps: + # This step creates a new deployment, check them out here: + # https://github.com/Khenziii/croissantdealer/deployments + - name: Start Deployment + uses: bobheadxi/deployments@v1 + id: deployment + with: + step: start + token: ${{ secrets.TOKEN_GITHUB }} + env: Production + + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup Docker Build + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + username: khenzii + password: ${{ secrets.DOCKER_PAT }} + + - name: Docker Build & Push + uses: docker/build-push-action@v5 + with: + push: true + tags: khenzii/croissantdealer:latest + + - name: Trigger Deployment Webhook + run: | + curl -X POST -d {} "${{ secrets.DEPLOY_WEBHOOK_URL }}" -H "Content-Type: application/json" + + - name: Update Deployment Status + uses: bobheadxi/deployments@v1 + if: always() + with: + step: finish + token: ${{ secrets.TOKEN_GITHUB }} + status: ${{ job.status }} + env: ${{ steps.deployment.outputs.env }} + deployment_id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..032df37 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.11-alpine AS base + +WORKDIR /app + +COPY . . + +RUN pip install --no-cache-dir -r requirements.txt + +CMD ["python3", "main.py"] + diff --git a/engine.py b/engine.py index af003e8..df067cf 100644 --- a/engine.py +++ b/engine.py @@ -196,8 +196,6 @@ def get_move(self, board: chess.Board = None, depth: int = 3) -> list[chess.Move return [best_move, best_eval] def minimax(self, board: chess.Board, depth: int, alpha: int, beta: int, maximizing: bool): - print(depth) - if not board: board = self.board diff --git a/main.py b/main.py index 59a1305..6d8d05a 100644 --- a/main.py +++ b/main.py @@ -305,4 +305,4 @@ def commands(self, game_id: str, croissantdealer: Croissantdealer, text: str = " thread = threading.Thread(target=bot.handle_event_stream, args=(stream, )) thread.start() else: - logs.error(f"Someting went wrong while trying to start the bot. Here is the error: {stream.text}") \ No newline at end of file + logs.error(f"Someting went wrong while trying to start the bot. Here is the error: {stream.text}")