feat🔫: docker镜像 & nginx
This commit is contained in:
parent
6fdee6a3b1
commit
48cef548c5
|
@ -1,7 +1,9 @@
|
|||
FROM nginx:alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./dist/* /usr/share/nginx/html
|
||||
COPY ./dist/ /usr/share/nginx/html
|
||||
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
|
||||
COPY default.conf.template /etc/nginx/templates/
|
||||
|
||||
EXPOSE 3000
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
server {
|
||||
listen ${NGINX_PORT};
|
||||
server_name ${NGINX_HOST}
|
||||
gzip on;
|
||||
|
||||
listen ${NGINX_PORT};
|
||||
server_name ${NGINX_HOST};
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri /index.html =404;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
location /api {
|
||||
location /api/ {
|
||||
proxy_pass ${NGINX_API_PROXY};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
proxy:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fadinglight/bill-react
|
||||
container_name: bill-react
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:80"
|
||||
environment:
|
||||
- NGINX_HOST=bill-react
|
||||
- NGINX_PORT=80
|
||||
- NGINX_API_PROXY=http://www.fadinglight.cn:8080/
|
|
@ -31,7 +31,6 @@ function App() {
|
|||
<Route path={"/chat"} element={<Chat/>}/>
|
||||
<Route path={"/editor"} element={<MdEditor/>}/>
|
||||
<Route path={'/login'} element={<Login/>}/>
|
||||
<Route path={'/*'} element={<NotFound/>}/>
|
||||
</Routes>
|
||||
</Layout>
|
||||
</BillContext.Provider>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import styles from './index.module.scss'
|
||||
import { NavLink, useLocation, useRoutes } from "react-router-dom";
|
||||
import React, {ReactElement, useState} from 'react';
|
||||
import React, { ReactElement, useMemo, useState } from 'react';
|
||||
import {
|
||||
Menu,
|
||||
MenuTheme,
|
||||
|
@ -31,7 +31,6 @@ export default function Layout(props: IProps) {
|
|||
|
||||
|
||||
const SiderMenu = (sprops: { theme?: MenuTheme }) => {
|
||||
const location = useLocation()
|
||||
|
||||
const siderTitleCSS: React.CSSProperties = {
|
||||
color: "white",
|
||||
|
@ -39,6 +38,12 @@ export default function Layout(props: IProps) {
|
|||
paddingInline: "10px",
|
||||
}
|
||||
const [collapsed, setCollapsed] = useState(false)
|
||||
|
||||
const location = useLocation()
|
||||
const selectedKey = useMemo(() => {
|
||||
return location.pathname === "/" ? "/home" : location.pathname
|
||||
}, [location.pathname])
|
||||
|
||||
return (
|
||||
<AntLayout.Sider
|
||||
collapsible
|
||||
|
@ -51,7 +56,7 @@ export default function Layout(props: IProps) {
|
|||
items={items}
|
||||
theme={sprops.theme}
|
||||
mode="inline"
|
||||
defaultSelectedKeys={[location.pathname]}
|
||||
defaultSelectedKeys={[selectedKey]}
|
||||
/>
|
||||
</AntLayout.Sider>
|
||||
)
|
||||
|
|
|
@ -5,7 +5,7 @@ import react from '@vitejs/plugin-react'
|
|||
export default defineConfig({
|
||||
server: {
|
||||
proxy: {
|
||||
"/api": {
|
||||
"/api/": {
|
||||
target: "http://www.fadinglight.cn:8080/",
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ""),
|
||||
|
|
Loading…
Reference in New Issue
Block a user