mirror of
https://dev.azure.com/tstanciu94/ReverseProxy/_git/ReverseProxy_Frontend
synced 2025-10-03 16:49:04 +03:00
Refactor configuration files for consistency and update Dockerfile base images
This commit is contained in:
parent
a8adedbd40
commit
d467172271
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"printWidth": 160,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"tabWidth": 2,
|
"singleQuote": false,
|
||||||
"semi": true,
|
"endOfLine": "auto"
|
||||||
"singleQuote": false
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Modern Dockerfile for Vite + React application
|
# Modern Dockerfile for Vite + React application
|
||||||
# Build stage
|
# Build stage
|
||||||
FROM node:18-alpine as builder
|
FROM 24.9-alpine3.21 AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ ENV VITE_BASE_PATH=${VITE_BASE_PATH}
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Production stage - Use nginx for better performance
|
# Production stage - Use nginx for better performance
|
||||||
FROM nginx:alpine
|
FROM nginx:1.29.1-alpine
|
||||||
|
|
||||||
# Remove default nginx website
|
# Remove default nginx website
|
||||||
RUN rm -rf /usr/share/nginx/html/*
|
RUN rm -rf /usr/share/nginx/html/*
|
||||||
@ -44,7 +44,7 @@ EXPOSE 80
|
|||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
HEALTHCHECK --interval=120s --timeout=10s --start-period=60s --retries=3 \
|
HEALTHCHECK --interval=120s --timeout=10s --start-period=60s --retries=3 \
|
||||||
CMD wget -q -O - http://localhost/ || exit 1
|
CMD curl -f http://localhost/ || exit 1
|
||||||
|
|
||||||
# Start nginx
|
# Start nginx
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from "vite";
|
||||||
import react from '@vitejs/plugin-react'
|
import react from "@vitejs/plugin-react";
|
||||||
import { resolve } from 'path'
|
import viteTsconfigPaths from "vite-tsconfig-paths";
|
||||||
import { readFileSync } from 'fs'
|
import checker from "vite-plugin-checker";
|
||||||
import viteTsconfigPaths from 'vite-tsconfig-paths'
|
import { readFileSync } from "node:fs";
|
||||||
import checker from 'vite-plugin-checker'
|
import { dirname, resolve } from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig(() => {
|
export default defineConfig(() => {
|
||||||
// Read package.json for version info
|
// Read package.json for version info
|
||||||
const packageJson = JSON.parse(readFileSync('./package.json', 'utf-8'))
|
const packageJson = JSON.parse(readFileSync("./package.json", "utf-8"));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: process.env.VITE_BASE_PATH ? `/${process.env.VITE_BASE_PATH}/` : '/',
|
base: process.env.VITE_BASE_PATH ? `/${process.env.VITE_BASE_PATH}/` : "/",
|
||||||
plugins: [
|
plugins: [
|
||||||
react(),
|
react(),
|
||||||
viteTsconfigPaths(), // Enables TypeScript path mapping from tsconfig.json
|
viteTsconfigPaths(), // Enables TypeScript path mapping from tsconfig.json
|
||||||
@ -21,21 +24,21 @@ export default defineConfig(() => {
|
|||||||
],
|
],
|
||||||
server: {
|
server: {
|
||||||
port: 3000,
|
port: 3000,
|
||||||
open: true,
|
open: true
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
outDir: 'build',
|
outDir: "build",
|
||||||
sourcemap: true,
|
sourcemap: true
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': resolve(__dirname, 'src'),
|
"@": resolve(__dirname, "src")
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
define: {
|
define: {
|
||||||
// Expose app version and build date as Vite environment variables
|
// Expose app version and build date as Vite environment variables
|
||||||
'import.meta.env.VITE_APP_VERSION': JSON.stringify(packageJson.version),
|
"import.meta.env.VITE_APP_VERSION": JSON.stringify(packageJson.version),
|
||||||
'import.meta.env.VITE_APP_DATE': JSON.stringify(new Date().toISOString()),
|
"import.meta.env.VITE_APP_DATE": JSON.stringify(new Date().toISOString())
|
||||||
},
|
|
||||||
}
|
}
|
||||||
})
|
};
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user