From 45ad1f5fb073138efd64322ff26d863cd98bc9e8 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Sat, 23 Nov 2024 12:40:30 +0100 Subject: [PATCH] feat: build tailwind for production on docker build --- Dockerfile | 4 +--- scripts/build_static.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 scripts/build_static.sh diff --git a/Dockerfile b/Dockerfile index b95a922..b73210a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,9 +14,7 @@ RUN apt-get update && \ apt-get autoremove -y COPY . /code - COPY nginx/nginx.conf /etc/nginx/sites-enabled/default -RUN python manage.py collectstatic --noinput - +RUN ["sh", "scripts/build_static.sh"] CMD [ "sh", "./scripts/run.sh" ] diff --git a/scripts/build_static.sh b/scripts/build_static.sh new file mode 100644 index 0000000..376e484 --- /dev/null +++ b/scripts/build_static.sh @@ -0,0 +1,12 @@ +# installs nvm (Node Version Manager) +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash + +# download and install Node.js (you may need to restart the terminal) +nvm install 22 + +python manage.py tailwind build +python manage.py collectstatic --noinput + +rm -rf ~/.nvm +rm -rf ~/.npm +rm -rf ~/.bower