Skip to content

Commit

Permalink
Get initial docker image working
Browse files Browse the repository at this point in the history
  • Loading branch information
lshemesh committed Nov 25, 2021
1 parent cee9547 commit 68b4f92
Show file tree
Hide file tree
Showing 4 changed files with 4,937 additions and 7 deletions.
18 changes: 12 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ FROM mhart/alpine-node:14 as common-build-stage
LABEL maintainer="[email protected]"
LABEL project="https://github.com/tchorwat/stockfish"

RUN apk add git

COPY ./entrypoint.sh /

RUN chmod +x /entrypoint.sh \
Expand All @@ -42,12 +44,16 @@ RUN chmod +x /entrypoint.sh \
&& adduser -u 1000 -G stockfish -HD stockfish

WORKDIR /stockfish/
USER stockfish:stockfish

COPY --chown=stockfish:stockfish --from=builder /Stockfish/src/stockfish /stockfish/
COPY --chown=stockfish:stockfish --from=builder /Stockfish/Copying.txt /stockfish/
COPY --chown=stockfish:stockfish source.txt /stockfish/
COPY --chown=stockfish:stockfish --from=builder /Stockfish/src/*.nnue /stockfish/
#USER stockfish:stockfish

#COPY --chown=stockfish:stockfish --from=builder /Stockfish/src/stockfish /stockfish/
#COPY --chown=stockfish:stockfish --from=builder /Stockfish/Copying.txt /stockfish/
#COPY --chown=stockfish:stockfish source.txt /stockfish/
#COPY --chown=stockfish:stockfish --from=builder /Stockfish/src/*.nnue /stockfish/
COPY --from=builder /Stockfish/src/stockfish /stockfish/
COPY --from=builder /Stockfish/Copying.txt /stockfish/
COPY source.txt /stockfish/
COPY --from=builder /Stockfish/src/*.nnue /stockfish/

EXPOSE 23249
# ENTRYPOINT ["/entrypoint.sh"]
Expand Down
12 changes: 12 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ const getExistentAnalyzerOrCreateNew = (game: GameToAnalyze) => {
return analyzersByGameId[game.id];
};

app.get("/", async (req, res) => {
const fen = "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1";
const engine = getExistentAnalyzerOrCreateNew({ id: "test", fen });

const engineRes = await engine.updateAndSearchOnce(fen);

return res.status(200).send({
ok: true,
engineRes,
});
});

app.post("/analyze", async (req: Request, res: Response) => {
try {
const { gameId, fen } = req.body;
Expand Down
Loading

0 comments on commit 68b4f92

Please sign in to comment.