Browse Source

update nodejs for tailwind

Prach Pongpanich 2 years ago
parent
commit
02371e2aca
5 changed files with 13 additions and 6 deletions
  1. 2 0
      .gitignore
  2. 2 3
      Dockerfile
  3. 2 2
      app/package.json
  4. 3 0
      app/static/css/input.css
  5. 4 1
      docker-compose.yml

+ 2 - 0
.gitignore

@@ -157,3 +157,5 @@ app/media/
157 157
 CACHE/
158 158
 media.zip
159 159
 data.zip
160
+
161
+app/static/css/main.css

+ 2 - 3
Dockerfile

@@ -6,12 +6,11 @@ RUN apt-get update && apt-get install apt-transport-https
6 6
 RUN apt-get install -y libjpeg62 libjpeg62-turbo-dev  zlib1g-dev gettext entr
7 7
 RUN \
8 8
         echo "Installing Node and Yarn" && \
9
-        echo "deb https://deb.nodesource.com/node_8.x jessie main" > /etc/apt/sources.list.d/nodesource.list && \
10
-        wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
9
+	curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
11 10
         echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \
12 11
         wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
13 12
         apt-get update && \
14
-        apt-get install -yqq nodejs yarn npm && \
13
+        apt-get install -yqq nodejs yarn  && \
15 14
         npm install -g nodemon && \ 
16 15
         rm -rf /var/lib/apt/lists/* 
17 16
 WORKDIR /code

+ 2 - 2
app/package.json

@@ -1,7 +1,7 @@
1 1
 {
2 2
   "scripts": {
3
-    "build": "tailwindcss -i ./css/input.css -o ./css/main.css ",
4
-    "watch": "tailwindcss -i ./css/input.css -o ./css/main.css --watch"
3
+    "build": "tailwindcss -i ./static/css/input.css -o ./static/css/main.css ",
4
+    "watch": "tailwindcss -i ./static/css/input.css -o ./static/css/main.css --watch"
5 5
   },
6 6
   "devDependencies": {
7 7
     "tailwindcss": "^3.3.2"

+ 3 - 0
app/static/css/input.css

@@ -0,0 +1,3 @@
1
+@tailwind base;
2
+@tailwind components;
3
+@tailwind utilities;

+ 4 - 1
docker-compose.yml

@@ -18,7 +18,10 @@ services:
18 18
       - POSTGRES_PASSWORD=postgres
19 19
   web:
20 20
     build: .
21
-    command: python -X dev manage.py  runserver 0.0.0.0:8000
21
+    command: >
22
+     sh -c "npm run watch &&
23
+            python manage.py migrate &&
24
+            python manage.py runserver 0.0.0.0:8000"
22 25
     #entrypoint: ./server-entrypoint.sh
23 26
     volumes:
24 27
       - ./app:/code