diff --git a/Dockerfile b/Dockerfile index a32439c..230cf8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,12 @@ +FROM node:alpine as node-modules + +WORKDIR /usr/src/app + +COPY package.json . +COPY package-lock.json . + +RUN npm install + FROM debian:testing-slim RUN apt-get update \ @@ -5,7 +14,6 @@ RUN apt-get update \ fonts-roboto \ inkscape \ nodejs \ - npm \ openscad \ pstoedit \ python3 \ @@ -14,14 +22,15 @@ RUN apt-get update \ WORKDIR /usr/src/app -COPY package.json . -COPY package-lock.json . +COPY --from=node-modules /usr/src/app/node_modules node_modules + COPY requirements.txt . -RUN npm install \ - && pip3 install -r requirements.txt +RUN pip3 install --no-cache-dir -r requirements.txt RUN mkdir static COPY . . ENTRYPOINT ["gunicorn", "-w", "4", "-b", "0.0.0.0:8000", "server:app"] + +EXPOSE 8000 diff --git a/requirements.txt b/requirements.txt index cf2a721..e4a286c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ flask gunicorn -lxml diff --git a/server.py b/server.py index f68b05c..f4ab099 100755 --- a/server.py +++ b/server.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 from flask import Flask, request, render_template, url_for, redirect -from lxml import etree from subprocess import run app = Flask(__name__)