Browse Source

Merge branch 'nodejs-old-version-fixed-via-docker' of mrcat323/old-react-project into master

Mr. CaT 🐈 1 year ago
parent
commit
6e71ead0c6
2 changed files with 27 additions and 0 deletions
  1. 12 0
      Dockerfile
  2. 15 0
      default.conf

+ 12 - 0
Dockerfile

@@ -0,0 +1,12 @@
+FROM node:14-alpine AS build
+
+WORKDIR /app
+ADD package*.json /app
+RUN npm install --legacy-peer-deps
+ADD . /app
+RUN npm run build
+
+FROM nginx:1.25.4-alpine
+
+COPY --from=build /app/default.conf /etc/nginx/conf.d/default.conf
+COPY --from=build /app/build /usr/share/nginx/html

+ 15 - 0
default.conf

@@ -0,0 +1,15 @@
+server {
+    listen 80;
+    server_name localhost;
+    root /usr/share/nginx/html;
+    auth_basic off;
+
+    location / {
+        try_files $uri $uri/ /index.html;
+    }
+
+    # 404 if a file is requested (so the main app isn't served)
+    location ~ ^.+\..+$ {
+        try_files $uri =404;
+    }
+}