Merge pull request #4 from redrockjs/dev

fix: dockerfile
This commit was merged in pull request #4.
This commit is contained in:
Valeriy G.
2025-05-28 09:49:27 +03:00
committed by GitHub
2 changed files with 14 additions and 6 deletions

View File

@@ -20,16 +20,20 @@ RUN npm run build
FROM node:22-alpine AS runner FROM node:22-alpine AS runner
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production \
NEXT_TELEMETRY_DISABLED=1
# Включаем node пользователя # Включаем node пользователя
RUN addgroup -g 1001 -S nodejs RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001 RUN adduser -S nextjs -u 1001
# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
# Копируем необходимые файлы из стадии builder # Копируем необходимые файлы из стадии builder
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/next.config.js ./next.config.js
# Переключаем на пользователя nextjs # Переключаем на пользователя nextjs
USER nextjs USER nextjs
@@ -38,4 +42,7 @@ USER nextjs
EXPOSE 3000 EXPOSE 3000
# Запускаем приложение # Запускаем приложение
CMD ["npm", "start"] ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
CMD ["node", "server.js"]

View File

@@ -2,6 +2,7 @@ import type { NextConfig } from "next";
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
/* config options here */ /* config options here */
output: 'standalone',
}; };
export default nextConfig; export default nextConfig;