summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2024-03-22 22:00:00 +0530
committerSunil Shetye2024-03-22 22:00:00 +0530
commit9b74cd92fdbbfeeddec2307842ffbd3712a681e3 (patch)
treea06ad14fa99e0bacaeaf0c9a31100fbd45af2a81
parent2d6bdaf916c34eeaabc3b1c46048c61cc98d3aee (diff)
downloadCommon-Interface-Project-9b74cd92fdbbfeeddec2307842ffbd3712a681e3.tar.gz
Common-Interface-Project-9b74cd92fdbbfeeddec2307842ffbd3712a681e3.tar.bz2
Common-Interface-Project-9b74cd92fdbbfeeddec2307842ffbd3712a681e3.zip
add dockerfile for prod
-rw-r--r--blocks/Dockerfile.patch17
-rwxr-xr-xblocks/install.sh7
-rwxr-xr-xblocks/run.sh6
3 files changed, 29 insertions, 1 deletions
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