From a3b9082a71c29836f1800e61a2fce36e36a898cf Mon Sep 17 00:00:00 2001 From: Alexis Date: Wed, 13 May 2026 12:59:47 +0200 Subject: [PATCH] chore: update Dockerfile and .dockerignore to clarify environment variable handling and improve build context; adjust Footer component to use dynamic base URL for logo --- frontend/.dockerignore | 5 +++-- frontend/Dockerfile | 6 +++++- frontend/src/components/layout/Footer.jsx | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/.dockerignore b/frontend/.dockerignore index 3e328fd..c0fa193 100644 --- a/frontend/.dockerignore +++ b/frontend/.dockerignore @@ -16,8 +16,9 @@ build/ .vite/ *.timestamp-* -# Secretos: docker-compose ya inyecta las variables vía `env_file`, -# no necesitamos copiarlos al filesystem de la imagen. +# Secretos: no subir `.env` al contexto de `docker build` (evita capas con claves). +# `env_file` en compose aplica al proceso en ejecución del servicio, no al paso +# `npm run build` del Dockerfile; las `VITE_*` deben estar disponibles ahí (ENV/ARG). .env .env.* !.env.example diff --git a/frontend/Dockerfile b/frontend/Dockerfile index ce870c4..a410a8a 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -7,7 +7,11 @@ COPY package.json package-lock.json ./ RUN npm ci COPY . . -RUN npm run build # genera dist/ con base=/orcid2words/ +# `env_file` en docker-compose solo inyecta variables en el contenedor al ARRANCAR +# (aquí nginx no usa Vite). `vite build` corre en esta fase y necesita `VITE_*` +# ya definidas: `.env` no entra en el contexto de build (.dockerignore). +ENV VITE_BASE_PATH=/orcid2words/ +RUN npm run build # ── Serve stage ──────────────────────────────────────────────── FROM nginx:alpine diff --git a/frontend/src/components/layout/Footer.jsx b/frontend/src/components/layout/Footer.jsx index c8b7654..eb9b709 100644 --- a/frontend/src/components/layout/Footer.jsx +++ b/frontend/src/components/layout/Footer.jsx @@ -55,7 +55,7 @@ export default function Footer() { de Jaén Logo UJA