fix
This commit is contained in:
1 parent
6f661b9365
commit
c8f89a7907
2 files changed
+6
-22
No files matched your search
@@ -1,27 +1,19 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
# ---- deps: instala dependencias (capa cacheable) ----
|
|
||||||
FROM node:22-alpine AS deps
|
FROM node:22-alpine AS deps
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
# ---- build: compila Next.js en modo standalone ----
|
|
||||||
FROM node:22-alpine AS build
|
FROM node:22-alpine AS build
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Variables NEXT_PUBLIC_* se incrustan en el bundle del cliente en build-time,
|
|
||||||
# por eso llegan como build-arg (desde docker-compose) y no solo como env de
|
|
||||||
# runtime del contenedor final.
|
|
||||||
ARG NEXT_PUBLIC_API_URL
|
ARG NEXT_PUBLIC_API_URL
|
||||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# ---- runtime: imagen final mínima (next.config.ts tiene output: "standalone") ----
|
|
||||||
FROM node:22-alpine AS runtime
|
FROM node:22-alpine AS runtime
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|||||||
+6
-14
@@ -1,17 +1,3 @@
|
|||||||
# Levanta solo el frontend (Next.js). El backend (Internal-API) tiene su
|
|
||||||
# propio docker-compose.yml en ese repositorio.
|
|
||||||
#
|
|
||||||
# NEXT_PUBLIC_API_URL se necesita en BUILD time (Next.js lo incrusta en el
|
|
||||||
# bundle del cliente), así que viene de `build.args`, no solo de `environment`.
|
|
||||||
# Docker Compose solo autocarga un archivo llamado ".env" en este mismo
|
|
||||||
# directorio para resolver los ${...} de este archivo — como aquí usamos
|
|
||||||
# ".env.production", hay que decírselo explícitamente al levantar:
|
|
||||||
#
|
|
||||||
# docker compose --env-file .env.production up -d --build
|
|
||||||
#
|
|
||||||
# (o copia/renombra .env.production a .env si prefieres el comportamiento
|
|
||||||
# por defecto de `docker compose up`).
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
@@ -24,3 +10,9 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "${FRONTEND_PORT:-3000}:3000"
|
- "${FRONTEND_PORT:-3000}:3000"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- rynext
|
||||||
|
|
||||||
|
networks:
|
||||||
|
rynext:
|
||||||
|
external: true
|
||||||
Reference in new issue
Block a user