瀏覽代碼

Install npm packages in Dockerfile

Son NK 5 年之前
父節點
當前提交
dab0a26cc3
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      Dockerfile

+ 10 - 1
Dockerfile

@@ -1,11 +1,20 @@
-FROM python:3.7
+# Install npm packages
+FROM node:10.17.0-alpine AS npm
+WORKDIR /code
+COPY ./static/package*.json /code/static/
+RUN cd /code/static && npm install
+
 
 
+FROM python:3.7
 WORKDIR /code
 WORKDIR /code
 
 
 # install dependencies
 # install dependencies
 COPY ./requirements.txt ./
 COPY ./requirements.txt ./
 RUN pip3 install --no-cache-dir -r requirements.txt
 RUN pip3 install --no-cache-dir -r requirements.txt
 
 
+# copy npm packages
+COPY --from=npm /code /code
+
 # copy everything else into /code
 # copy everything else into /code
 COPY . .
 COPY . .