hamza82 commited on
Commit
1c8bc29
·
verified ·
1 Parent(s): 4f265df

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -6
Dockerfile CHANGED
@@ -36,20 +36,26 @@ COPY --chown=pn frontend frontend
36
  WORKDIR $HOME/app/frontend
37
  RUN npm install
38
  RUN npm run build
39
- RUN ls
40
- RUN pwd
41
- COPY --chown=pn $HOME/app/frontend/dist/. /usr/share/nginx/html
42
- # Switch back to app directory
 
 
 
 
 
 
 
 
43
  USER pn
44
  WORKDIR $HOME/app
45
 
46
  COPY --chown=pn backend backend
47
-
48
  COPY --chown=pn default.conf /etc/nginx/conf.d/default.conf
49
 
50
  # Prepare the entrypoint script
51
  COPY --chown=pn run.sh run.sh
52
-
53
  RUN chmod +x run.sh
54
 
55
  # Expose the port 8080
 
36
  WORKDIR $HOME/app/frontend
37
  RUN npm install
38
  RUN npm run build
39
+
40
+ # Debugging: Check if dist directory exists after build
41
+ RUN ls -la
42
+ RUN if [ ! -d "dist" ]; then echo "Build did not create dist directory, exiting..."; exit 1; fi
43
+
44
+ # Switch to the directory where nginx expects static files
45
+ WORKDIR /usr/share/nginx/html
46
+
47
+ # Copy the build output to the nginx serving directory
48
+ COPY --chown=pn $HOME/app/frontend/dist .
49
+
50
+ # Switch back to the app directory and setup the backend
51
  USER pn
52
  WORKDIR $HOME/app
53
 
54
  COPY --chown=pn backend backend
 
55
  COPY --chown=pn default.conf /etc/nginx/conf.d/default.conf
56
 
57
  # Prepare the entrypoint script
58
  COPY --chown=pn run.sh run.sh
 
59
  RUN chmod +x run.sh
60
 
61
  # Expose the port 8080