Dockerizado y con script de instalación
This commit is contained in:
3
frontend/.gitignore
vendored
3
frontend/.gitignore
vendored
@@ -10,7 +10,8 @@ lerna-debug.log*
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
*.localnode_modules
|
||||
.DS_Store
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
|
||||
36
frontend/Dockerfile
Normal file
36
frontend/Dockerfile
Normal file
@@ -0,0 +1,36 @@
|
||||
# frontend/Dockerfile
|
||||
|
||||
# 1) Fase de build
|
||||
FROM node:20-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copiamos sólo package.json para cachear mejor
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
# Copiamos el resto del código
|
||||
COPY . .
|
||||
|
||||
# Variable para que el front apunte a nginx (/api -> backend)
|
||||
ARG VITE_API_BASE_URL=/api
|
||||
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
|
||||
|
||||
# Construimos el bundle
|
||||
RUN npm run build
|
||||
|
||||
# 2) Fase de servidor estático
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copiamos el build
|
||||
COPY --from=build /app/dist ./dist
|
||||
|
||||
# Server estático muy simple
|
||||
RUN npm install -g serve
|
||||
|
||||
EXPOSE 4173
|
||||
|
||||
CMD ["serve", "-s", "dist", "-l", "4173"]
|
||||
5
frontend/dockerignore
Normal file
5
frontend/dockerignore
Normal file
@@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
dist
|
||||
.vscode
|
||||
.DS_Store
|
||||
*.log
|
||||
8
frontend/package-lock.json
generated
8
frontend/package-lock.json
generated
@@ -21,7 +21,7 @@
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.14.0",
|
||||
"@types/node": "^22.19.3",
|
||||
"@vitejs/plugin-react": "^5.0.0",
|
||||
"typescript": "~5.8.2",
|
||||
"vite": "^6.2.0"
|
||||
@@ -1793,9 +1793,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "22.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.1.tgz",
|
||||
"integrity": "sha512-LCCV0HdSZZZb34qifBsyWlUmok6W7ouER+oQIGBScS8EsZsQbrtFTUrDX4hOl+CS6p7cnNC4td+qrSVGSCTUfQ==",
|
||||
"version": "22.19.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.3.tgz",
|
||||
"integrity": "sha512-1N9SBnWYOJTrNZCdh/yJE+t910Y128BoyY+zBLWhL3r0TYzlTmFdXrPwHL9DyFZmlEXNQQolTZh3KHV31QDhyA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.14.0",
|
||||
"@types/node": "^22.19.3",
|
||||
"@vitejs/plugin-react": "^5.0.0",
|
||||
"typescript": "~5.8.2",
|
||||
"vite": "^6.2.0"
|
||||
|
||||
@@ -8,7 +8,7 @@ type SegmentMapping = {
|
||||
};
|
||||
|
||||
const API_BASE_URL =
|
||||
import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000';
|
||||
import.meta.env.VITE_API_BASE_URL || '';
|
||||
|
||||
function getAuthHeader(): Record<string, string> {
|
||||
const user = import.meta.env.VITE_API_USERNAME;
|
||||
|
||||
Reference in New Issue
Block a user