feat: reestructuracion para easypanel y variables de entorno
This commit is contained in:
24
frontend/Dockerfile
Normal file
24
frontend/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
||||
# Etapa 1: Compilación de la aplicación de React + Vite
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
# Recibir la variable de entorno VITE_API_URL en tiempo de construcción (build arg)
|
||||
ARG VITE_API_URL
|
||||
ENV VITE_API_URL=$VITE_API_URL
|
||||
|
||||
# Copiar los manifiestos de dependencias e instalarlas
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
# Copiar el código fuente y compilar el proyecto
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Etapa 2: Servir los archivos estáticos usando Nginx
|
||||
FROM nginx:alpine
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user