first commit

This commit is contained in:
2026-07-16 20:48:43 -03:00
commit 5696cee264
1111 changed files with 322270 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
# Etapa 1: Build del servidor
FROM node:22-alpine AS build-server
WORKDIR /app/server
COPY server/package*.json ./
RUN npm install --production --omit=dev \
&& npm cache clean --force \
&& rm -rf /root/.npm /tmp/* # Limpiar caché de npm y archivos temporales
COPY server ./
RUN npx tsoa spec-and-routes && npm run build \
&& rm -rf /app/server/src /app/server/tests # Eliminar archivos innecesarios de source y test
# Etapa 2: Build del cliente
FROM node:22-alpine AS build-client
WORKDIR /app/txclient
COPY txclient/package*.json ./
RUN npm install --production --omit=dev \
&& npm cache clean --force \
&& rm -rf /root/.npm /tmp/* # Limpiar caché de npm y archivos temporales
COPY txclient ./
RUN npm run build \
&& rm -rf /app/txclient/src /app/txclient/tests /app/txclient/node_modules # Eliminar archivos innecesarios de source y test
# Etapa final: Solo lo necesario para correr
FROM node:22-alpine AS production
ENV NODE_ENV=production \
TZ=America/Argentina/Buenos_Aires
# Configurar timezone y bash
RUN apk add --no-cache tzdata bash && \
cp /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo "${TZ}" > /etc/timezone
# Crear estructura final
WORKDIR /app
# Copiar sólo los archivos de distribución y node_modules necesarios
# Server
COPY --from=build-server /app/server/build ./server/build
COPY --from=build-server /app/server/package.json ./server/
COPY --from=build-server /app/server/node_modules ./server/node_modules
# Cliente
COPY --from=build-client /app/txclient/.next ./txclient/.next
COPY --from=build-client /app/txclient/package.json ./txclient/
# Limpiar los archivos innecesarios del entorno de producción
RUN rm -rf /app/txclient/tests /app/server/tests /app/txclient/src /app/server/src \
&& rm -rf /app/server/package*.json /app/txclient/package*.json \
&& rm -rf /app/txclient/node_modules /app/server/node_modules \
&& rm -rf /app/server/.npm /app/txclient/.npm /tmp/* # Limpiar caches y node_modules no necesarios
# Puertos que usas
EXPOSE 3000 3001 3021
# Comando de inicio
CMD [ "sh", "-c", "npm --prefix /app/server start & npm --prefix /app/txclient start" ]