FROM nikolaik/python-nodejs:python3.7-nodejs14

ARG ENV
ENV ENV=${ENV}

WORKDIR /workspace

COPY server/requirements.txt /workspace/server/requirements.txt
RUN pip3 install -r /workspace/server/requirements.txt

COPY static/package.json /workspace/static/package.json
COPY static/package-lock.json /workspace/static/package-lock.json
WORKDIR /workspace/static
RUN npm install

# Flask
COPY server/. /workspace/server/

# NPM
COPY static/. /workspace/static/
RUN npm run-script build

# Run server
WORKDIR /workspace/server
CMD exec gunicorn --timeout 60 --bind :8080 main:app