Skip to content

Commit cbbc48b

Browse files
committed
run app through docker
1 parent bc0b97b commit cbbc48b

7 files changed

+64
-6
lines changed

docker-compose.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "3.8"
2+
3+
services:
4+
codegate-ui:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
image: codegate-ui
9+
ports:
10+
- "3000:80"
11+
container_name: codegate-ui

dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM node:20.18.0-alpine AS builder
2+
3+
WORKDIR /usr/src/app
4+
5+
COPY package*.json tailwind.config.ts postcss.config.js tsconfig*.json vite.config.ts index.html favicon.ico ./
6+
7+
RUN npm install
8+
9+
COPY ./src ./src
10+
COPY ./public ./public
11+
12+
RUN npm run build
13+
14+
FROM nginx:stable-alpine
15+
16+
COPY --from=builder /usr/src/app/dist /usr/share/nginx/html
17+
18+
EXPOSE 80
19+
20+
CMD ["nginx", "-g", "daemon off;"]

nginx.conf

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
server {
2+
listen 80;
3+
4+
server_name localhost;
5+
6+
root /usr/share/nginx/html;
7+
8+
index index.html;
9+
10+
location / {
11+
try_files $uri /index.html;
12+
}
13+
14+
location /assets/ {
15+
root /usr/share/nginx/html;
16+
expires max;
17+
add_header Cache-Control public;
18+
}
19+
}

public/vite.svg

-1
This file was deleted.

tsconfig.app.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
"noFallthroughCasesInSwitch": true,
2323
"noUncheckedSideEffectImports": true
2424
},
25-
"include": ["src"]
25+
"include": ["src/**/*.ts", "src/**/*.tsx"],
26+
"exclude": ["node_modules"]
2627
}

tsconfig.node.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
"noFallthroughCasesInSwitch": true,
2121
"noUncheckedSideEffectImports": true
2222
},
23-
"include": ["vite.config.ts"]
23+
"include": ["vite.config.ts"],
24+
"exclude": ["node_modules"]
2425
}

vite.config.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
import { defineConfig } from 'vite'
2-
import react from '@vitejs/plugin-react-swc'
1+
import { defineConfig } from "vite";
2+
import react from "@vitejs/plugin-react-swc";
33

44
// https://vite.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7-
})
7+
base: "./",
8+
build: {
9+
outDir: "dist",
10+
rollupOptions: {
11+
input: "./index.html",
12+
},
13+
},
14+
});

0 commit comments

Comments
 (0)