Skip to content

Commit

Permalink
backend docker container runs but...
Browse files Browse the repository at this point in the history
Will need to configure the robotic arm to interface with it
  • Loading branch information
SjoenH committed May 30, 2024
1 parent f65869f commit f014c47
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
8 changes: 8 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**/__pycache__
**/*.pyc
**/*.pyo
**/*.pyd
*.git
.dockerignore
Dockerfile*
*.md
28 changes: 21 additions & 7 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,38 @@ RUN apt-get update && apt-get install -y \
libpq-dev \
wget \
tar \
git \
g++ \
make \
&& rm -rf /var/lib/apt/lists/*

# Install Stockfish
RUN wget https://github.com/official-stockfish/Stockfish/releases/latest/download/stockfish-ubuntu-x86-64-vnni512.tar -O /tmp/stockfish.tar && \
tar -xvf /tmp/stockfish.tar -C /usr/local/bin/ && \
rm /tmp/stockfish.tar
# Check the architecture
RUN uname -m

# Clone Stockfish and compile it
RUN git clone https://github.com/official-stockfish/Stockfish.git && \
cd Stockfish/src && \
make build ARCH=armv8 && \
cp stockfish /usr/local/bin/ && \
chmod +x /usr/local/bin/stockfish && \
cd ../.. && \
rm -rf Stockfish

# Copy only the requirements file
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
# Copy the start script and the rest of the application code
COPY start.sh .
COPY . .

# Give execute permissions to the start script
RUN chmod +x start.sh

# Expose the port the app runs on
EXPOSE 5000

# Command to run the application
CMD ["python", "server.py"]
# Command to run the start script
CMD ["./start.sh"]
5 changes: 3 additions & 2 deletions backend/server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from argparse import ArgumentParser
from flask import Flask
from flask_socketio import SocketIO
from config import STOCKFISH_PATH
from chessLogic.chessLogic import ChessLogic
from certaboHelper.certabo import Certabo
from certaboHelper.initCertabo import InitializeCertabo
Expand All @@ -18,7 +17,9 @@
if platform.system() == 'Windows':
pStockfish ="/chessLogic/windowsStockfish/stockfish-windows.exe"
elif platform.system() == 'Darwin': #Darwin for MacOS
pStockfish = STOCKFISH_PATH
pStockfish = "/opt/homebrew/bin/stockfish"
else: #Default to Linux
pStockfish ="/usr/local/bin/stockfish"

chess_logic = ChessLogic(pStockfish)

Expand Down
4 changes: 4 additions & 0 deletions backend/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

echo "Starting Python application..."
python server.py

0 comments on commit f014c47

Please sign in to comment.