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;} - - + + - - - + + +