From 13bed8768c938b36aabe5cfec2dfb39c472b7554 Mon Sep 17 00:00:00 2001 From: Wong Chee Hong Date: Wed, 15 Nov 2023 17:42:09 +0800 Subject: [PATCH] Fix nginx deployment --- frontend/Dockerfile.prod | 1 + frontend/nginx.conf | 15 +++++++++++++++ frontend/src/reducers/authSlice.ts | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 frontend/nginx.conf diff --git a/frontend/Dockerfile.prod b/frontend/Dockerfile.prod index 48f1bcd4..cd19ec4a 100644 --- a/frontend/Dockerfile.prod +++ b/frontend/Dockerfile.prod @@ -10,6 +10,7 @@ RUN npm run build # Serve stage FROM nginx:alpine +COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/build /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 00000000..5727b7e6 --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri /index.html; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} \ No newline at end of file diff --git a/frontend/src/reducers/authSlice.ts b/frontend/src/reducers/authSlice.ts index b494267e..513deaf1 100644 --- a/frontend/src/reducers/authSlice.ts +++ b/frontend/src/reducers/authSlice.ts @@ -30,7 +30,7 @@ const dummyAdmin: User = { }; const initialState: AuthState = { - user: dummyUser // null + user: null } const userSlice = createSlice({