]> git.aero2k.de Git - sirius.git/commitdiff
Dockerize sirius
authorTomas Wagner <tomas.wagner@gmail.com>
Sun, 4 Feb 2018 20:21:28 +0000 (21:21 +0100)
committerTomas Wagner <tomas.wagner@gmail.com>
Sun, 4 Feb 2018 20:26:04 +0000 (21:26 +0100)
Dockerfile [new file with mode: 0644]
README.md
docker-compose.yml [new file with mode: 0644]

diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..0aa4064
--- /dev/null
@@ -0,0 +1,27 @@
+FROM debian:9.3-slim
+
+WORKDIR /sirius
+
+RUN apt-get update -y && mkdir -p /usr/share/man/man1 && mkdir -p /usr/share/man/man7 && apt-get install -y python python-pip libpq-dev phantomjs libfreetype6-dev fontconfig libgstreamer1.0-dev python-dev wget libjpeg-dev zlib1g-dev postgresql-9.6
+
+RUN apt-get autoremove -y
+
+RUN pip install --upgrade pip
+
+ADD ./requirements.txt /sirius/requirements.txt
+RUN pip install -r requirements.txt
+
+RUN wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
+RUN tar jxf phantomjs-2.1.1-linux-x86_64.tar.bz2
+RUN rm phantomjs-2.1.1-linux-x86_64.tar.bz2
+RUN mv phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
+
+RUN pip install honcho
+
+EXPOSE 5000
+
+ADD . .
+
+RUN ./manage.py db upgrade
+
+ENTRYPOINT honcho start
index 63b45f51b1e43a2da9a9036e4d2f080f00f284bc..1b2963ac3fc7a65186c07c931043623c20ffb495 100644 (file)
--- a/README.md
+++ b/README.md
@@ -46,6 +46,11 @@ sudo mv phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
 
 ~/.local/bin/gunicorn -k flask_sockets.worker manage:app -b 0.0.0.0:5002 -w 1
 ```
+or use Docker Compose, just type:
+
+```
+docker-compose up
+```
 
 *With PhantomJS 1.9.8 I can't print pictures but version 2.1.1 seems to fix the problem*.
 
@@ -103,7 +108,7 @@ boolean little_print(String face, String message, String endpoint, String api_ke
     com.mashape.unirest.http.HttpResponse<String> request = Unirest.post(endpoint+"?api_key="+api_key)
       .body("{\"message\": \"" + message.replace("\"", "\\\"") +"\", \"face\": \"" + face.replace("\"", "\\\"") + "\"}")
       .asString();
-  
+
     println(request.getBody());
     return true;
   } catch (Exception e) {
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644 (file)
index 0000000..12f4f31
--- /dev/null
@@ -0,0 +1,11 @@
+version: '2'
+
+services:
+  sirius:
+    build:
+      context: ./
+      dockerfile: ./Dockerfile
+    ports:
+      - 5000:5000
+    env_file:
+     - .env