ashwinR commited on
Commit
e4ef1fc
1 Parent(s): 335d121

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -2
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- # Use an official Node.js runtime as base image for frontend
2
  FROM node:14 as frontend
3
 
4
  WORKDIR /frontend
@@ -9,11 +9,19 @@ RUN npm install
9
  COPY frontend /frontend
10
  RUN npm run build
11
 
12
- # Use an official Python runtime for backend
13
  FROM python:3.8-slim
14
 
15
  WORKDIR /app
16
 
 
 
 
 
 
 
 
 
17
  # Install node to serve the React app
18
  RUN apt-get update && apt-get install -y nodejs npm && apt-get clean
19
 
 
1
+ # Frontend Stage
2
  FROM node:14 as frontend
3
 
4
  WORKDIR /frontend
 
9
  COPY frontend /frontend
10
  RUN npm run build
11
 
12
+ # Backend Stage
13
  FROM python:3.8-slim
14
 
15
  WORKDIR /app
16
 
17
+ # Set environment variables for custom cache directories
18
+ ENV NPM_CONFIG_PREFIX=/app/.npm-global
19
+ ENV XDG_CACHE_HOME=/app/.cache
20
+
21
+ # Ensure cache directories exist and have correct permissions
22
+ RUN mkdir -p /app/.npm-global && chown -R 1000:0 /app/.npm-global
23
+ RUN mkdir -p /app/.cache && chown -R 1000:0 /app/.cache
24
+
25
  # Install node to serve the React app
26
  RUN apt-get update && apt-get install -y nodejs npm && apt-get clean
27