diff --git a/frontend/Dockerfile b/frontend/Dockerfile index a3b089c..41c27a9 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,6 +1,7 @@ # Build stage -FROM node:18-alpine AS build +FROM node:18 as build-stage +# Set working directory WORKDIR /app # Copy package files @@ -9,29 +10,25 @@ COPY package*.json ./ # Install dependencies RUN npm install -# Copy source code +# Copy project files COPY . . -# Install Vue compiler globally -RUN npm install -g @vue/compiler-sfc - -# Set environment variables -ENV NODE_ENV=production -ENV VITE_API_URL=/api +# Install Vue dependencies +RUN npm install vue@latest @vitejs/plugin-vue vue-tsc typescript # Build the application with increased memory limit RUN NODE_OPTIONS="--max-old-space-size=4096" npm run build # Production stage -FROM nginx:alpine +FROM nginx:stable-alpine as production-stage -# Copy built files from build stage -COPY --from=build /app/dist /usr/share/nginx/html +# Copy built files +COPY --from=build-stage /app/dist /usr/share/nginx/html # Copy nginx configuration COPY nginx.conf /etc/nginx/conf.d/default.conf -# Expose port 80 +# Expose port EXPOSE 80 # Start nginx diff --git a/frontend/package.json b/frontend/package.json index 4250351..da32470 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,42 +1,32 @@ { - "name": "employee-request-system-frontend", - "version": "1.0.0", - "description": "Frontend for Employee Request System", + "name": "admin-portal", "private": true, + "version": "0.0.0", + "type": "module", "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test --watchAll=false --passWithNoTests", - "eject": "react-scripts eject" + "dev": "vite", + "build": "vue-tsc --noEmit && vite build", + "preview": "vite preview", + "test": "echo \"No tests configured yet\" && exit 0" }, "dependencies": { - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-router-dom": "^6.21.1", - "react-scripts": "5.0.1", - "axios": "^1.6.5" + "@vueuse/core": "^10.9.0", + "axios": "^1.6.2", + "chart.js": "^4.4.1", + "lucide-vue-next": "^0.344.0", + "pinia": "^2.1.7", + "vue": "^3.4.21", + "vue-router": "^4.3.0" }, "devDependencies": { - "@testing-library/jest-dom": "^5.17.0", - "@testing-library/react": "^13.4.0", - "@testing-library/user-event": "^13.5.0" - }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] + "@tailwindcss/forms": "^0.5.7", + "@types/node": "^20.17.11", + "@vitejs/plugin-vue": "^5.0.4", + "autoprefixer": "^10.4.18", + "postcss": "^8.4.35", + "tailwindcss": "^3.4.1", + "typescript": "^5.2.2", + "vite": "^5.1.4", + "vue-tsc": "^2.0.6" } } \ No newline at end of file diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 6866a0b..66a5179 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -9,23 +9,26 @@ export default defineConfig({ plugins: [vue()], resolve: { alias: { - '@': path.resolve(__dirname, './src'), + '@': path.resolve(__dirname, 'src'), }, }, - optimizeDeps: { - include: ['axios'] + build: { + chunkSizeWarningLimit: 1600, + rollupOptions: { + output: { + manualChunks(id) { + if (id.includes('node_modules')) { + return 'vendor'; + } + } + } + } }, server: { - host: true, - port: 5173, - watch: { - usePolling: true - }, proxy: { '/api': { target: 'http://localhost:8000', changeOrigin: true, - secure: false } } }