Docker deployment setup

main
MiguelMLorente 2025-11-29 15:14:24 +01:00
parent f95cba9042
commit 26b228197e
3 changed files with 32 additions and 11 deletions

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM node:20
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
RUN npm run build
EXPOSE 8000
CMD [ "npm", "run", "preview" ]

View File

@ -18,7 +18,6 @@
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"erasableSyntaxOnly": false,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true "noUncheckedSideEffectImports": true
}, },

View File

@ -2,20 +2,27 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react"; import react from "@vitejs/plugin-react";
const serverRoutes = ["/access", "/buy/start", "/buy/complete", "/buy/cancel"]; const serverRoutes = ["/access", "/buy/start", "/buy/complete", "/buy/cancel"];
const baseServerConfigBuilder = (domain: string) => ({
// https://vite.dev/config/
export default defineConfig({
server: {
proxy: Object.fromEntries( proxy: Object.fromEntries(
serverRoutes.map((key) => [ serverRoutes.map((key) => [
key, key,
{ {
target: "http://localhost:3000", target: `http://${domain}:3000`,
changeOrigin: true, changeOrigin: true,
secure: false, secure: false,
}, },
]), ]),
), ),
port: 8000,
strictPort: true,
});
// https://vite.dev/config/
export default defineConfig({
server: {
...baseServerConfigBuilder("localhost"),
host: true
}, },
preview: baseServerConfigBuilder("paysplit-app"),
plugins: [react()], plugins: [react()],
}); });