From fd0974134b0285e4b21d19447cfee7d73adb7779 Mon Sep 17 00:00:00 2001 From: alban Date: Wed, 21 Oct 2020 14:39:48 +0200 Subject: [PATCH 1/3] [enh] Fist working version --- canvas.js | 37 +++++++++++++++++++++++----- index.html | 9 ++++--- manage.py | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ post.py | 49 +++++++++++++++++++++++++++++++++++++ worker.py | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 222 insertions(+), 9 deletions(-) create mode 100644 manage.py create mode 100644 post.py create mode 100644 worker.py diff --git a/canvas.js b/canvas.js index 76efcdd..14f3c1c 100644 --- a/canvas.js +++ b/canvas.js @@ -1,10 +1,8 @@ $(document).ready(function(){ -console.log("ok") - var binary_level = 100 - + var url = "http://localhost" // Grab elements, create settings, etc. var canvas = document.getElementById('canvas'); @@ -19,6 +17,7 @@ console.log("ok") context.drawImage(video, 0, 0, 640, 480); binary(context) $("#result").show() + $('html, body').animate({scrollTop: $("#result").offset().top}, 2000); } @@ -62,7 +61,7 @@ console.log("ok") } // Trigger photo take - document.getElementById('snap').addEventListener('click', function() { + $('.snap').on('click', function() { snap() }); function binary(context){ @@ -77,7 +76,6 @@ console.log("ok") var thresh_red = binary_level; var thresh_green = binary_level; var thresh_blue = binary_level; - console.log( binary_level ) var channels = image.data.length/4; for(var i=0;iSending...') + + $.ajax({ + url: url + "/image", + method:"POST", + dataType: "json", + data:{ + image_data : image_data, + text : $("#text").val() + }, + + }).done(function(d,m,j){ + if( d.errors ){ + msg = d.errors.join(" / ") + $("#messages").html(``) + return + } + $("#messages").html(``) + imageList = localStorage.getItem("imageList") ? JSON.parse(localStorage.getItem("imageList")) : [] + imageList.push(d.hash_name) + localStorage.setItem("imageList",JSON.stringify(imageList)) + }) + .fail(function(d,m,jq){ + $("#messages").html(``) + + }) }) }) diff --git a/index.html b/index.html index 1662ffd..5848d8f 100644 --- a/index.html +++ b/index.html @@ -36,7 +36,7 @@ window.ORIGINAL_JSON=window.JSON;
- +

By allowing the use of your camera, you will be able to take snapshots, convert them to black and white images before sending them to the laser server. How cool is that?!

@@ -45,7 +45,7 @@ window.ORIGINAL_JSON=window.JSON;
-

Not satisfied of the contrast?

+

Not satisfied of the contrast?



@@ -56,9 +56,12 @@ window.ORIGINAL_JSON=window.JSON;

Satisfied?

Type the text visible on your image (if any) and push Send.

- +
+ +
+
diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..341119c --- /dev/null +++ b/manage.py @@ -0,0 +1,72 @@ +#! /usr/bin/python3 +from datetime import datetime +from redis import Redis +import argparse +import json +import os +import sys + +modeList = { + "list" : ["l","list"], + "delete" : ["d","delete"], + "exit" : ["x","q","exit"], + "preview" : ["p","preview"], +} + +argsparser = argparse.ArgumentParser(description="manager") +argsparser.add_argument("-m","--mode",help="The action to perform. One of : {}".format(", ".join(modeList.keys())),default="list",type=str) +argsparser.add_argument("-P","--path",help="clitools path",default="~/code/lj-nano/clitools",type=str) +argsparser.add_argument("-i","--ip",help="IP address of the Redis server ",default="127.0.0.1",type=str) +argsparser.add_argument("-p","--port",help="Port of the Redis server ",default="6379",type=str) +args = argsparser.parse_args() +mode = args.mode +clipath = args.path +port = args.port +ip = args.ip + +r = Redis(host=ip, port=port) + +hashList = [] + +def refreshList(): + global hashList + hashList = {} + theList = r.hgetall("images") + for i in theList: + item = json.loads(theList[i]) + theList[i] = item + + # Sort by reverse Date + for i in sorted(theList.items(),key=lambda x: x[1]['created_at'],reverse=True): + hashList[i[0].decode("ascii")] = i[1] + + +while True: + refreshList() + if mode in modeList["list"] : + print("hash\t\t\tdate\t\t\tpoints info") + for i in hashList: + item = hashList[i] + pl = item["points_list"] + created_at = item["created_at"] + print("{}\t{}\t{} points".format(i,datetime.ctime(datetime.fromtimestamp(created_at)),len(pl))) + + elif mode in modeList["delete"]: + print("Select a hash to delete") + hash_name = input() + result = r.hdel("images",hash_name) + print("Result: {}".format(result)) + + elif mode in modeList["preview"]: + print("Select a hash to preview") + hash_name = input() + item = json.loads(hashList[bytes(hash_name,'ascii')]) + points_list = json.dumps(item["points_list"]) + bashCommand = "while true; do echo '"+points_list+"'; sleep 0.5; done | /usr/bin/python3 "+clipath+"/exports/tosimu.py" + os.system(bashCommand) + + elif mode in modeList["exit"]: + break + + print("Next action? (l)ist (d)elete e(x)it (p)review") + mode = input() diff --git a/post.py b/post.py new file mode 100644 index 0000000..8e85cf5 --- /dev/null +++ b/post.py @@ -0,0 +1,49 @@ +#! /usr/bin/python3 +import flask +from redis import Redis +from flask import Flask, redirect, url_for, request +import json +import hashlib +import time + +r = Redis() +app = Flask(__name__) +m = hashlib.sha256() +@app.route('/dashboard/') +def dashboard(name): + return 'welcome %s' % name + +@app.route('/image',methods = ['POST', 'GET']) +def image(): + try: + data = dict() + + # Clean the request + if "text" in request.form: + data["text"] = request.form["text"][:256] + else : + data["text"] = "" + + if "image_data" in request.form: + data["image_data"] = request.form["image_data"] + else: + raise Exception("image_data is mandatory") + + m.update( bytes(time.asctime(), 'utf-8')) + hash_name = m.hexdigest()[:16] + data["hash_name"] = hash_name + + # Save to queue + r.rpush("image-convert",json.dumps(data)) + return( json.dumps({ + "message":"ok", + "hash_name":hash_name + }) ) + + except Exception as e: + print("woah",e) + return( json.dumps( {"errors":[ str(e)]})) + + +if __name__ == '__main__': + app.run(debug = True) diff --git a/worker.py b/worker.py new file mode 100644 index 0000000..6e12ba4 --- /dev/null +++ b/worker.py @@ -0,0 +1,64 @@ +#! /usr/bin/python3 +from io import BytesIO +from numpy import asarray +from PIL import Image +from redis import Redis +import base64 +import json +import potrace +import re +import time + +color = 65280 +r = Redis() + +def convertImg(src, image_path="/tmp/"): + base64_data = re.sub('^data:image/.+;base64,', '', src) + byte_data = base64.b64decode(base64_data) + image_data = BytesIO(byte_data) + img = Image.open(image_data).convert("1") + return img + +# Read results from redis +data = r.lpop('image-convert') +while data : + try: + item = json.loads(data) + image_data = item["image_data"] + text = item["text"] + hash_name = item["hash_name"] + + # Vectorize the image + image = convertImg( image_data ) + bmp = potrace.Bitmap( asarray( image ) ) + + # Trace the bitmap to a path + path = bmp.trace(turdsize=16,alphamax=0.0, opticurve=0, opttolerance=1.0) + pl = [] + + for curve in path: + start = curve.start_point + pl.append([int(start[0]),int(start[1]),0]) + pl.append([int(start[0]),int(start[1]),color]) + for segment in curve: + end_point_x, end_point_y = segment.end_point + if segment.is_corner: + c_x, c_y = segment.c + pl.append([int(c_x),int(c_y),color]) + pass + # + else: + c1_x, c1_y = segment.c1 + x, y = segment.c2 + pl.append([int(x),int(y),color]) + pl.append([int(c1_x),int(c1_y),color]) + # + pl.append([start[0],start[1],0]) + item["points_list"] = pl + item["created_at"] = time.time() + r.hset("images",hash_name, json.dumps(item)) + data = r.lpop('image-convert') + + except Exception as e: + print("woops",e) + break From b31f725d043e9fba0b1415440ec3a04607bb2a5a Mon Sep 17 00:00:00 2001 From: alban Date: Thu, 22 Oct 2020 20:44:24 +0200 Subject: [PATCH 2/3] [fix] Reworks structure and adds docker --- .dockerignore | 0 .env.template | 3 ++ .gitignore | 1 + Dockerfile | 29 ++++++++++++++ bootstrap => css/bootstrap | 0 .../css/bootstrap-grid.css | 0 .../css/bootstrap-grid.css.map | 0 .../css/bootstrap-grid.min.css | 0 .../css/bootstrap-grid.min.css.map | 0 .../css/bootstrap-reboot.css | 0 .../css/bootstrap-reboot.css.map | 0 .../css/bootstrap-reboot.min.css | 0 .../css/bootstrap-reboot.min.css.map | 0 .../bootstrap-4.5.3-dist}/css/bootstrap.css | 0 .../css/bootstrap.css.map | 0 .../css/bootstrap.min.css | 0 .../css/bootstrap.min.css.map | 0 .../js/bootstrap.bundle.js | 0 .../js/bootstrap.bundle.js.map | 0 .../js/bootstrap.bundle.min.js | 0 .../js/bootstrap.bundle.min.js.map | 0 .../bootstrap-4.5.3-dist}/js/bootstrap.js | 0 .../bootstrap-4.5.3-dist}/js/bootstrap.js.map | 0 .../bootstrap-4.5.3-dist}/js/bootstrap.min.js | 0 .../js/bootstrap.min.js.map | 0 bootstrap.min.css => css/bootstrap.min.css | 0 docker-compose.yml | 36 +++++++++++++++++ entrypoint.sh | 5 +++ files/nginx/sites-enabled/site.conf | 13 ++++++ index.html | 10 ++--- canvas.js => js/canvas.js | 2 +- jquery-3.5.1.min.js => js/jquery-3.5.1.min.js | 0 jquery-ui => js/jquery-ui | 0 .../jquery-ui-1.12.1.custom}/AUTHORS.txt | 0 .../jquery-ui-1.12.1.custom}/LICENSE.txt | 0 .../external/jquery/jquery.js | 0 .../ui-bg_diagonals-thick_18_b81900_40x40.png | Bin .../ui-bg_diagonals-thick_20_666666_40x40.png | Bin .../images/ui-bg_glass_100_f6f6f6_1x400.png | Bin .../images/ui-bg_glass_100_fdf5ce_1x400.png | Bin .../images/ui-bg_glass_65_ffffff_1x400.png | Bin .../ui-bg_gloss-wave_35_f6a828_500x100.png | Bin .../ui-bg_highlight-soft_100_eeeeee_1x100.png | Bin .../ui-bg_highlight-soft_75_ffe45c_1x100.png | Bin .../images/ui-icons_222222_256x240.png | Bin .../images/ui-icons_228ef1_256x240.png | Bin .../images/ui-icons_ef8c08_256x240.png | Bin .../images/ui-icons_ffd27a_256x240.png | Bin .../images/ui-icons_ffffff_256x240.png | Bin .../jquery-ui-1.12.1.custom}/index.html | 0 .../jquery-ui-1.12.1.custom}/jquery-ui.css | 0 .../jquery-ui-1.12.1.custom}/jquery-ui.js | 0 .../jquery-ui.min.css | 0 .../jquery-ui-1.12.1.custom}/jquery-ui.min.js | 0 .../jquery-ui.structure.css | 0 .../jquery-ui.structure.min.css | 0 .../jquery-ui.theme.css | 0 .../jquery-ui.theme.min.css | 0 .../jquery-ui-1.12.1.custom}/package.json | 0 post.py => server.py | 37 +++++++++++++----- 60 files changed, 120 insertions(+), 16 deletions(-) create mode 100644 .dockerignore create mode 100644 .env.template create mode 100644 .gitignore create mode 100644 Dockerfile rename bootstrap => css/bootstrap (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap-grid.css (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap-grid.css.map (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap-grid.min.css (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap-grid.min.css.map (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap-reboot.css (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap-reboot.css.map (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap-reboot.min.css (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap-reboot.min.css.map (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap.css (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap.css.map (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap.min.css (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/css/bootstrap.min.css.map (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/js/bootstrap.bundle.js (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/js/bootstrap.bundle.js.map (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/js/bootstrap.bundle.min.js (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/js/bootstrap.bundle.min.js.map (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/js/bootstrap.js (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/js/bootstrap.js.map (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/js/bootstrap.min.js (100%) rename {bootstrap-4.5.3-dist => css/bootstrap-4.5.3-dist}/js/bootstrap.min.js.map (100%) rename bootstrap.min.css => css/bootstrap.min.css (100%) create mode 100644 docker-compose.yml create mode 100644 entrypoint.sh create mode 100644 files/nginx/sites-enabled/site.conf rename canvas.js => js/canvas.js (99%) rename jquery-3.5.1.min.js => js/jquery-3.5.1.min.js (100%) rename jquery-ui => js/jquery-ui (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/AUTHORS.txt (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/LICENSE.txt (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/external/jquery/jquery.js (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-bg_diagonals-thick_18_b81900_40x40.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-bg_diagonals-thick_20_666666_40x40.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-bg_glass_100_f6f6f6_1x400.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-bg_glass_100_fdf5ce_1x400.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-bg_glass_65_ffffff_1x400.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-bg_gloss-wave_35_f6a828_500x100.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-bg_highlight-soft_100_eeeeee_1x100.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-bg_highlight-soft_75_ffe45c_1x100.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-icons_222222_256x240.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-icons_228ef1_256x240.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-icons_ef8c08_256x240.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-icons_ffd27a_256x240.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/images/ui-icons_ffffff_256x240.png (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/index.html (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/jquery-ui.css (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/jquery-ui.js (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/jquery-ui.min.css (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/jquery-ui.min.js (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/jquery-ui.structure.css (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/jquery-ui.structure.min.css (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/jquery-ui.theme.css (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/jquery-ui.theme.min.css (100%) rename {jquery-ui-1.12.1.custom => js/jquery-ui-1.12.1.custom}/package.json (100%) rename post.py => server.py (55%) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e69de29 diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..b8d8062 --- /dev/null +++ b/.env.template @@ -0,0 +1,3 @@ +DB_HOST="127.0.0.1" +DB_PORT="6379" +DEBUG=1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c6c5ba1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM python:3.8-slim +LABEL name=laser-app version=0.1 + +WORKDIR /opt +RUN apt update +RUN apt install -y --no-install-recommends build-essential\ + gcc\ + libagg2-dev\ + libpotrace-dev\ + nginx-light\ + pkg-config\ + python-dev\ + redis-server +RUN rm -f /etc/nginx/sites-enabled/* +RUN pip3 install flask numpy pillow redis +RUN pip3 install pypotrace + +COPY ./files/nginx/sites-enabled/site.conf /etc/nginx/sites-enabled +COPY . . + +COPY entrypoint.sh /usr/bin/ +RUN chmod +x /usr/bin/entrypoint.sh + +EXPOSE 80 +EXPOSE 5000 +EXPOSE 9001 + +# Start the main process. +CMD ["python", "./server.py", "-i", "db"] diff --git a/bootstrap b/css/bootstrap similarity index 100% rename from bootstrap rename to css/bootstrap diff --git a/bootstrap-4.5.3-dist/css/bootstrap-grid.css b/css/bootstrap-4.5.3-dist/css/bootstrap-grid.css similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap-grid.css rename to css/bootstrap-4.5.3-dist/css/bootstrap-grid.css diff --git a/bootstrap-4.5.3-dist/css/bootstrap-grid.css.map b/css/bootstrap-4.5.3-dist/css/bootstrap-grid.css.map similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap-grid.css.map rename to css/bootstrap-4.5.3-dist/css/bootstrap-grid.css.map diff --git a/bootstrap-4.5.3-dist/css/bootstrap-grid.min.css b/css/bootstrap-4.5.3-dist/css/bootstrap-grid.min.css similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap-grid.min.css rename to css/bootstrap-4.5.3-dist/css/bootstrap-grid.min.css diff --git a/bootstrap-4.5.3-dist/css/bootstrap-grid.min.css.map b/css/bootstrap-4.5.3-dist/css/bootstrap-grid.min.css.map similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap-grid.min.css.map rename to css/bootstrap-4.5.3-dist/css/bootstrap-grid.min.css.map diff --git a/bootstrap-4.5.3-dist/css/bootstrap-reboot.css b/css/bootstrap-4.5.3-dist/css/bootstrap-reboot.css similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap-reboot.css rename to css/bootstrap-4.5.3-dist/css/bootstrap-reboot.css diff --git a/bootstrap-4.5.3-dist/css/bootstrap-reboot.css.map b/css/bootstrap-4.5.3-dist/css/bootstrap-reboot.css.map similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap-reboot.css.map rename to css/bootstrap-4.5.3-dist/css/bootstrap-reboot.css.map diff --git a/bootstrap-4.5.3-dist/css/bootstrap-reboot.min.css b/css/bootstrap-4.5.3-dist/css/bootstrap-reboot.min.css similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap-reboot.min.css rename to css/bootstrap-4.5.3-dist/css/bootstrap-reboot.min.css diff --git a/bootstrap-4.5.3-dist/css/bootstrap-reboot.min.css.map b/css/bootstrap-4.5.3-dist/css/bootstrap-reboot.min.css.map similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap-reboot.min.css.map rename to css/bootstrap-4.5.3-dist/css/bootstrap-reboot.min.css.map diff --git a/bootstrap-4.5.3-dist/css/bootstrap.css b/css/bootstrap-4.5.3-dist/css/bootstrap.css similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap.css rename to css/bootstrap-4.5.3-dist/css/bootstrap.css diff --git a/bootstrap-4.5.3-dist/css/bootstrap.css.map b/css/bootstrap-4.5.3-dist/css/bootstrap.css.map similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap.css.map rename to css/bootstrap-4.5.3-dist/css/bootstrap.css.map diff --git a/bootstrap-4.5.3-dist/css/bootstrap.min.css b/css/bootstrap-4.5.3-dist/css/bootstrap.min.css similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap.min.css rename to css/bootstrap-4.5.3-dist/css/bootstrap.min.css diff --git a/bootstrap-4.5.3-dist/css/bootstrap.min.css.map b/css/bootstrap-4.5.3-dist/css/bootstrap.min.css.map similarity index 100% rename from bootstrap-4.5.3-dist/css/bootstrap.min.css.map rename to css/bootstrap-4.5.3-dist/css/bootstrap.min.css.map diff --git a/bootstrap-4.5.3-dist/js/bootstrap.bundle.js b/css/bootstrap-4.5.3-dist/js/bootstrap.bundle.js similarity index 100% rename from bootstrap-4.5.3-dist/js/bootstrap.bundle.js rename to css/bootstrap-4.5.3-dist/js/bootstrap.bundle.js diff --git a/bootstrap-4.5.3-dist/js/bootstrap.bundle.js.map b/css/bootstrap-4.5.3-dist/js/bootstrap.bundle.js.map similarity index 100% rename from bootstrap-4.5.3-dist/js/bootstrap.bundle.js.map rename to css/bootstrap-4.5.3-dist/js/bootstrap.bundle.js.map diff --git a/bootstrap-4.5.3-dist/js/bootstrap.bundle.min.js b/css/bootstrap-4.5.3-dist/js/bootstrap.bundle.min.js similarity index 100% rename from bootstrap-4.5.3-dist/js/bootstrap.bundle.min.js rename to css/bootstrap-4.5.3-dist/js/bootstrap.bundle.min.js diff --git a/bootstrap-4.5.3-dist/js/bootstrap.bundle.min.js.map b/css/bootstrap-4.5.3-dist/js/bootstrap.bundle.min.js.map similarity index 100% rename from bootstrap-4.5.3-dist/js/bootstrap.bundle.min.js.map rename to css/bootstrap-4.5.3-dist/js/bootstrap.bundle.min.js.map diff --git a/bootstrap-4.5.3-dist/js/bootstrap.js b/css/bootstrap-4.5.3-dist/js/bootstrap.js similarity index 100% rename from bootstrap-4.5.3-dist/js/bootstrap.js rename to css/bootstrap-4.5.3-dist/js/bootstrap.js diff --git a/bootstrap-4.5.3-dist/js/bootstrap.js.map b/css/bootstrap-4.5.3-dist/js/bootstrap.js.map similarity index 100% rename from bootstrap-4.5.3-dist/js/bootstrap.js.map rename to css/bootstrap-4.5.3-dist/js/bootstrap.js.map diff --git a/bootstrap-4.5.3-dist/js/bootstrap.min.js b/css/bootstrap-4.5.3-dist/js/bootstrap.min.js similarity index 100% rename from bootstrap-4.5.3-dist/js/bootstrap.min.js rename to css/bootstrap-4.5.3-dist/js/bootstrap.min.js diff --git a/bootstrap-4.5.3-dist/js/bootstrap.min.js.map b/css/bootstrap-4.5.3-dist/js/bootstrap.min.js.map similarity index 100% rename from bootstrap-4.5.3-dist/js/bootstrap.min.js.map rename to css/bootstrap-4.5.3-dist/js/bootstrap.min.js.map diff --git a/bootstrap.min.css b/css/bootstrap.min.css similarity index 100% rename from bootstrap.min.css rename to css/bootstrap.min.css diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..66abfbb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,36 @@ +version: '2' + +volumes: + laserrdb: + external: true + +services: + + db: + env_file: .env + image: redis:6-alpine + ports: + - "6379:6379" + volumes: + - laserrdb:/var/lib/redis + + app: + env_file: .env + build: . + image: teamlaser/laser-app:latest + ports: + - "5000:5000" + depends_on: + - db + command: python ./server.py + + assets: + env_file: .env + build: . + image: teamlaser/laser-app:latest + ports: + - "8080:80" + depends_on: + - app + command: nginx -g 'daemon off;error_log /dev/stdout info;' + diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..2b300a5 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -e + + +exec "$@" diff --git a/files/nginx/sites-enabled/site.conf b/files/nginx/sites-enabled/site.conf new file mode 100644 index 0000000..3cfd899 --- /dev/null +++ b/files/nginx/sites-enabled/site.conf @@ -0,0 +1,13 @@ +server { + server_name _; + listen 80 default_server; + listen [::]:80 default_server; + root /opt/; + location /image { + proxy_pass http://app:5000; + } + # Docker specific conf + resolver 127.0.0.11 ipv6=off; + access_log /dev/stdout; + +} diff --git a/index.html b/index.html index 5848d8f..3790a27 100644 --- a/index.html +++ b/index.html @@ -12,12 +12,12 @@ #canvas { margin-top: 20px; border: 1px solid #ccc; display: block; } span.ui-slider-handle.ui-corner-all.ui-state-default { background: dodgerblue;} - - + + - - - + + +