docker compose

This commit is contained in:
2026-01-21 22:05:21 +00:00
parent 0df0baf822
commit 0f764b1239
3 changed files with 39 additions and 7 deletions

View File

@@ -1,8 +1,26 @@
FROM node:20-alpine
# ---------- BUILD ----------
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json .
COPY package.json package-lock.json ./
RUN npm install
COPY . .
ENV REACT_APP_API_URL=http://localhost:5015/
EXPOSE 3000
CMD ["npm", "start"]
# Variável de ambiente correta para Vite
ENV VITE_API_URL=http://localhost:5050/
RUN npm run build
# ---------- SERVE ----------
FROM nginx:alpine
# Copia os ficheiros do build para a pasta do nginx
COPY --from=build /app/dist /usr/share/nginx/html
# Configuração mínima do nginx (opcional: para SPA fallback)
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]