Skip to content

Commit

Permalink
feat(ci/cd): docker (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Khenziii authored May 25, 2024
1 parent b0bb567 commit 31beffa
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
.dockerignore
.gitattributes
.gitignore
Dockerfile
LICENSE
README.md

54 changes: 54 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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 }}
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

2 changes: 0 additions & 2 deletions engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
logs.error(f"Someting went wrong while trying to start the bot. Here is the error: {stream.text}")

0 comments on commit 31beffa

Please sign in to comment.