refactor: update Dockerfile to use Nginx for serving the application and adjust configuration for multi-stage build
This commit is contained in:
+5
-8
@@ -10,13 +10,10 @@ COPY . .
|
||||
RUN npm run build # genera dist/ con base=/orcid2words/
|
||||
|
||||
# ── Serve stage ────────────────────────────────────────────────
|
||||
FROM node:20-alpine
|
||||
FROM nginx:alpine
|
||||
|
||||
WORKDIR /app
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=builder /app/dist /app/dist
|
||||
|
||||
RUN npm install -g serve
|
||||
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
EXPOSE 8073
|
||||
CMD ["serve", "-s", "dist", "-l", "5173"]
|
||||
EXPOSE 5173
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
server {
|
||||
listen 5173;
|
||||
listen [::]:5173;
|
||||
server_name _;
|
||||
|
||||
root /app/dist;
|
||||
index index.html;
|
||||
|
||||
# Apache forwards the full path; strip /orcid2words/ before resolving files under dist/.
|
||||
location = /orcid2words {
|
||||
return 301 /orcid2words/;
|
||||
}
|
||||
|
||||
location /orcid2words/ {
|
||||
rewrite ^/orcid2words/(.*)$ /$1 break;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user