1641
This commit is contained in:
parent
e39970587b
commit
8f9659ea5b
1 changed files with 19 additions and 2 deletions
21
Dockerfile
21
Dockerfile
|
|
@ -5,11 +5,27 @@ FROM node:20-alpine AS builder
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
# Copia pacotes e instala dependências
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
# Copia o restante do código
|
||||
COPY . .
|
||||
|
||||
# ---------- Variáveis de build ----------
|
||||
# Estas variáveis são usadas pelo Next.js durante o "build"
|
||||
# para embutir no bundle do frontend.
|
||||
ARG NEXT_PUBLIC_ORIUS_APP_STATE
|
||||
ARG NEXT_PUBLIC_ORIUS_APP_API_URL
|
||||
ARG NEXT_PUBLIC_ORIUS_APP_API_PREFIX
|
||||
ARG NEXT_PUBLIC_ORIUS_APP_API_CONTENT_TYPE
|
||||
|
||||
ENV NEXT_PUBLIC_ORIUS_APP_STATE=$NEXT_PUBLIC_ORIUS_APP_STATE
|
||||
ENV NEXT_PUBLIC_ORIUS_APP_API_URL=$NEXT_PUBLIC_ORIUS_APP_API_URL
|
||||
ENV NEXT_PUBLIC_ORIUS_APP_API_PREFIX=$NEXT_PUBLIC_ORIUS_APP_API_PREFIX
|
||||
ENV NEXT_PUBLIC_ORIUS_APP_API_CONTENT_TYPE=$NEXT_PUBLIC_ORIUS_APP_API_CONTENT_TYPE
|
||||
|
||||
# ---------- Build ----------
|
||||
ENV NODE_ENV=production
|
||||
RUN npm run build
|
||||
|
||||
|
|
@ -20,6 +36,7 @@ FROM node:20-alpine AS runner
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
# ---------- Variáveis em runtime ----------
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
|
|
@ -29,7 +46,7 @@ COPY --from=builder /app/.next/static ./.next/static
|
|||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/package*.json ./
|
||||
|
||||
# Corrige permissões (para cache de imagens, etc.)
|
||||
# ---------- Corrige permissões ----------
|
||||
RUN addgroup -S nodejs && adduser -S nextjs -G nodejs \
|
||||
&& mkdir -p .next/cache/images \
|
||||
&& chown -R nextjs:nodejs /app
|
||||
|
|
@ -38,5 +55,5 @@ USER nextjs
|
|||
|
||||
EXPOSE 3000
|
||||
|
||||
# Executa o servidor standalone gerado pelo Next
|
||||
# ---------- Executa o servidor ----------
|
||||
CMD ["node", "server.js"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue