OSDN Git Service

Fix #36822: Build a Docker image for Shogi-server
authorDaigo Moriwaki <daigo@debian.org>
Sat, 26 Nov 2016 09:02:22 +0000 (18:02 +0900)
committerDaigo Moriwaki <daigo@debian.org>
Sat, 26 Nov 2016 09:02:22 +0000 (18:02 +0900)
.dockerignore [new file with mode: 0644]
.gitignore [new file with mode: 0644]
Dockerfile [new file with mode: 0644]
Makefile
changelog

diff --git a/.dockerignore b/.dockerignore
new file mode 100644 (file)
index 0000000..3fcac59
--- /dev/null
@@ -0,0 +1,14 @@
+Dockerfile
+.dockerignore
+.git
+.*
+00LIST
+logs
+20*
+**/20*
+**/*.log
+**/*.yaml
+**/*.conf
+**/*.sh
+**/*.back
+**/*.dat
diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..f304ca7
--- /dev/null
@@ -0,0 +1 @@
+.image-*
diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..1a92e79
--- /dev/null
@@ -0,0 +1,20 @@
+FROM debian
+MAINTAINER Daigo Moriwaki <daigo@debian.org>
+
+RUN apt-get update && apt-get install -y \
+        apt-utils \
+        ruby ruby-gsl
+RUN gem install rgl
+
+ENV EVENT local
+ENV PORT 4081
+ENV MAX_IDENTIFIER 32
+
+WORKDIR /shogi-server
+CMD mkdir $WORKDIR
+CMD mkdir /logs
+
+COPY . ./
+
+CMD ./shogi-server --daemon /logs --pid-file shogi-server.pid --max-identifier $MAX_IDENTIFIER $EVENT $PORT && tail -F /logs/shogi-server.log
+
index c46701c..affadf1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,12 @@ stop-daemon:
 test-time-run: 
        ruby -r sample/test_time.rb ./shogi-server --floodgate-games floodgate-900-0,floodgate-3600-0 hoge 4000 
 
 test-time-run: 
        ruby -r sample/test_time.rb ./shogi-server --floodgate-games floodgate-900-0,floodgate-3600-0 hoge 4000 
 
+.PHONY: image-build
+image-build: .image-build
+.image-build: Dockerfile
+       docker build -t shogi-server/shogi-server:latest -f $< .
+       docker images -q shogi-server/shogi-server:latest > $@
+
 .PHONY: clean
 clean:
 .PHONY: clean
 clean:
-       -rm -rf doc
+       -rm -rf doc .image-*
index da428cd..0d9c640 100644 (file)
--- a/changelog
+++ b/changelog
@@ -7,6 +7,12 @@
            by specifying randomly generated tokens. It would of help to add a
            new command line option --max-identifier to overwrite the default
            maximum length.
            by specifying randomly generated tokens. It would of help to add a
            new command line option --max-identifier to overwrite the default
            maximum length.
+       * Build a Docker image for Shogi-server
+         (Closes #36822)
+         - Build a Docker image
+             % make image-build
+         - Running a local shogi-server would look like
+             % docker run -p 4081:4081 -v `pwd`/logs:/logs shogi-server/shogi-server
 
 2016-04-09  Daigo Moriwaki <daigo at debian dot org>
 
 
 2016-04-09  Daigo Moriwaki <daigo at debian dot org>