From 9b74cd92fdbbfeeddec2307842ffbd3712a681e3 Mon Sep 17 00:00:00 2001 From: Sunil Shetye Date: Fri, 22 Mar 2024 22:00:00 +0530 Subject: add dockerfile for prod --- blocks/Dockerfile.patch | 17 +++++++++++++++++ blocks/install.sh | 7 +++++++ blocks/run.sh | 6 +++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 blocks/Dockerfile.patch diff --git a/blocks/Dockerfile.patch b/blocks/Dockerfile.patch new file mode 100644 index 00000000..b933c455 --- /dev/null +++ b/blocks/Dockerfile.patch @@ -0,0 +1,17 @@ +--- blocks/Dockerfile 2024-03-22 13:29:04.368574427 +0530 ++++ blocks/Dockerfile.1 2024-03-22 20:47:14.630043479 +0530 +@@ -121,7 +121,7 @@ + COPY . . + + # Configure venv and sqlite3 +-RUN ./install.sh ++RUN ./install.sh prod + + # Cleanup + RUN apt-get autoremove -qq --purge gawk python3-pip python3-venv wget xz-utils +@@ -172,4 +172,4 @@ + + WORKDIR ${XCOS_DIR} + +-CMD ["./run.sh"] ++CMD ["./run.sh", "prod"] diff --git a/blocks/install.sh b/blocks/install.sh index 48461638..c2937ee9 100755 --- a/blocks/install.sh +++ b/blocks/install.sh @@ -3,7 +3,14 @@ set -e cd eda-frontend +if test "$1" = 'prod'; then + npm install -g serve +fi npm install --silent +if test "$1" = 'prod'; then + npm run build + rm -rf node_modules public src +fi echo 'WDS_SOCKET_PORT=8000' > .env.local cd .. diff --git a/blocks/run.sh b/blocks/run.sh index 20788d8f..02e6e55c 100755 --- a/blocks/run.sh +++ b/blocks/run.sh @@ -9,7 +9,11 @@ service redis-server start celery -A blocks.celery_tasks worker --loglevel INFO --concurrency 1 & cd eda-frontend -npm start & +if test "$1" = 'prod'; then + serve -l 3500 -n -s --no-port-switching build & +else + npm start & +fi cd .. python manage.py runserver -- cgit