Update Dockerfile
Browse files- Dockerfile +10 -2
Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
#
|
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 |
-
#
|
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 |
|