Some checks failed
CI / build (20.15.1) (push) Failing after 15m20s
修复Dockerfile中使用addgroup/adduser命令导致的兼容性问题,改用groupadd/useradd 修正CI配置中分支条件判断错误,将dev改为develop
26 lines
616 B
Docker
26 lines
616 B
Docker
# Use the official lightweight Bun image
|
|
FROM oven/bun:latest AS base
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Create non-root user and set permissions
|
|
RUN groupadd -r -g 1001 nodejs \
|
|
&& useradd -r -u 1001 -g nodejs nextjs
|
|
|
|
# Copy build output and static files
|
|
COPY ./apps/user/.next/standalone ./
|
|
COPY ./apps/user/.next/static ./apps/user/.next/static
|
|
COPY ./apps/user/public ./apps/user/public
|
|
|
|
# Change ownership to non-root user
|
|
RUN chown -R nextjs:nodejs /app
|
|
|
|
USER nextjs
|
|
|
|
# Disable Next.js telemetry
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
# Default command to start the server
|
|
CMD ["bun", "apps/user/server.js"]
|