From 1189fb219abd7a1206b6c365b316368e1bf65a7b Mon Sep 17 00:00:00 2001 From: Astrid Date: Wed, 13 Jan 2021 12:56:00 +0100 Subject: [PATCH] Update Dockerfile for frontend build --- .dockerignore | 6 ++++++ .gitignore | 2 ++ Dockerfile | 19 +++++++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5c484d3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +venv/ +matteo_env/ +__pycache__/ +simmadome/node_modules +data/ +.git/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index b4a7181..af99f24 100644 --- a/.gitignore +++ b/.gitignore @@ -344,6 +344,7 @@ config.json games_config.json weather_config.json ids +data/ # database matteo.db @@ -351,5 +352,6 @@ matteo.db-wal matteo.db-shm /data/leagues/* /matteo_env/Lib/site-packages/flask_socketio/__init__.py +Pipfile env diff --git a/Dockerfile b/Dockerfile index 75d8a22..fc250eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,20 @@ -FROM python:3.8 -EXPOSE 5000 - +# - Build stage 1: frontend (simmadome/ directory) +FROM node:alpine AS frontend WORKDIR /app -COPY . ./ +COPY simmadome/package.json simmadome/package-lock.json ./ +RUN npm install +COPY simmadome/ ./ +RUN npm run build + +# - Build stage 2: backend (Python) +FROM python:3.8 +EXPOSE 5000 +WORKDIR /app + +COPY requirements.txt . RUN pip install -r requirements.txt +COPY . ./ +COPY --from=frontend /app/build/ simmadome/build/ CMD ["python", "the_prestige.py"]