From b30e1961b569eaa5a2a8624540c83878137a4bde Mon Sep 17 00:00:00 2001 From: Gabriel Pariat Date: Mon, 14 Nov 2022 19:37:21 -0500 Subject: [PATCH] finish Dockerfile --- Dockerfile | 26 ++++++++++++++++++++++++++ client/src/online-game.lisp | 2 +- server/server.asd | 2 +- server/src/server.lisp | 3 ++- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..979a7e3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM debian:bookworm + +ENV buildpkgs "curl sbcl" +ENV qlurl https://beta.quicklisp.org/quicklisp.lisp + +WORKDIR /usr/src/pariatech-pong/ +COPY init.lisp . +COPY game ./game +COPY server ./server + +RUN apt update && \ + apt install -y ${buildpkgs} && \ + apt auto-remove -y && \ + curl -SOL ${qlurl} && \ + sbcl --load quicklisp.lisp \ + --eval "(quicklisp-quickstart:install)" \ + --eval "(sb-ext:quit)" + +EXPOSE 54321/tcp + +CMD sbcl --load ~/quicklisp/setup.lisp \ + --eval "(load \"game/game.asd\")" \ + --eval "(load \"server/server.asd\")" \ + --eval "(ql:quickload \"server\")" \ + --eval "(in-package :pong.server)" \ + --eval "(main)" \ No newline at end of file diff --git a/client/src/online-game.lisp b/client/src/online-game.lisp index 2da170e..d9a874b 100644 --- a/client/src/online-game.lisp +++ b/client/src/online-game.lisp @@ -52,7 +52,7 @@ `(start-online-game% (make-instance 'online-game ,@args))) (defun open-socket () - (setf *socket* (usocket:socket-connect "127.0.0.1" 54321 :element-type 'unsigned-byte)) + (setf *socket* (usocket:socket-connect "pariatech.com" 54321 :element-type 'unsigned-byte)) (setf *stream* (usocket:socket-stream *socket*))) (defun write-to-server (data) diff --git a/server/server.asd b/server/server.asd index ea8c074..9cea889 100644 --- a/server/server.asd +++ b/server/server.asd @@ -8,7 +8,7 @@ :serial t :depends-on ("game" "usocket" "bordeaux-threads") :build-operation "program-op" - :build-pathname "../../AppDir/usr/bin/server" + :build-pathname "../../bin/server" :entry-point "pong.server:main" :pathname "src" :components diff --git a/server/src/server.lisp b/server/src/server.lisp index 310416f..c23f73e 100644 --- a/server/src/server.lisp +++ b/server/src/server.lisp @@ -67,7 +67,7 @@ (handle-message action stream client))) (defun open-server-socket (port) - (usocket:socket-listen "127.0.0.1" port :reuse-address t :element-type 'unsigned-byte)) + (usocket:socket-listen "0.0.0.0" port :reuse-address t :element-type 'unsigned-byte)) (defun wait-for-sockets-ready (connections) (usocket:wait-for-input connections :ready-only t :timeout 5)) @@ -185,6 +185,7 @@ ;; (stop-server) (defun main () + (format t "Starting server!~%") (unwind-protect (start-server 54321) (stop-server)))