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)))