xarical commited on
Commit
8544a13
·
1 Parent(s): 762c6c4

Move Node.js installation in Dockerfile (fixes 940e723bcdb93fb39d63f5f7264c2fc1a2385cd6)

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -12
Dockerfile CHANGED
@@ -14,9 +14,12 @@ WORKDIR $HOME/app
14
  # Switch to root
15
  USER root
16
 
17
- # Install nginx and packages.txt
18
  COPY --chown=root packages.txt packages.txt
19
- RUN apt-get -y update && apt-get -y install nginx && xargs apt-get -y install < packages.txt
 
 
 
20
 
21
  # Give app permissions to 'user' (non-root)
22
  RUN chown user:user .
@@ -24,13 +27,13 @@ RUN chown user:user .
24
  # Give nginx permissions to 'user' (non-root)
25
  # See https://www.rockyourcode.com/run-docker-nginx-as-non-root-user/
26
  RUN mkdir -p /var/cache/nginx \
27
- /var/log/nginx \
28
- /var/lib/nginx
29
  RUN touch /var/run/nginx.pid
30
  RUN chown -R user:user /var/cache/nginx \
31
- /var/log/nginx \
32
- /var/lib/nginx \
33
- /var/run/nginx.pid
34
 
35
  # Switch to 'user' (non-root)
36
  USER user
@@ -39,11 +42,9 @@ USER user
39
  COPY --chown=user requirements.txt requirements.txt
40
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
41
 
42
- # Install Node.js and Playwright
43
- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
44
- apt-get install -y nodejs && \
45
- npm install -g npm && \
46
- npm install express playwright
47
 
48
  # Copy nginx configuration
49
  COPY --chown=user nginx.conf /etc/nginx/sites-available/default
 
14
  # Switch to root
15
  USER root
16
 
17
+ # Install nginx, Node.js, and packages.txt
18
  COPY --chown=root packages.txt packages.txt
19
+ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
20
+ apt-get -y update && apt-get -y install nginx && apt-get install -y nodejs && \
21
+ xargs apt-get -y install < packages.txt && \
22
+ npm install -g npm
23
 
24
  # Give app permissions to 'user' (non-root)
25
  RUN chown user:user .
 
27
  # Give nginx permissions to 'user' (non-root)
28
  # See https://www.rockyourcode.com/run-docker-nginx-as-non-root-user/
29
  RUN mkdir -p /var/cache/nginx \
30
+ /var/log/nginx \
31
+ /var/lib/nginx
32
  RUN touch /var/run/nginx.pid
33
  RUN chown -R user:user /var/cache/nginx \
34
+ /var/log/nginx \
35
+ /var/lib/nginx \
36
+ /var/run/nginx.pid
37
 
38
  # Switch to 'user' (non-root)
39
  USER user
 
42
  COPY --chown=user requirements.txt requirements.txt
43
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
44
 
45
+ # Install package-lock.json
46
+ COPY --chown=user package.json package-lock.json ./
47
+ RUN npm install
 
 
48
 
49
  # Copy nginx configuration
50
  COPY --chown=user nginx.conf /etc/nginx/sites-available/default