简体中文
学习如何将ShipThing部署为Docker容器。
next.config.ts
nextConfig.output = 'standalone';
apps/web/Dockerfile
FROM node:22-alpine AS base ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable FROM base AS builder RUN apk add --no-cache libc6-compat RUN apk update WORKDIR /app RUN pnpm add -g turbo COPY . . RUN turbo prune @repo/web --docker FROM base AS installer RUN apk add --no-cache libc6-compat RUN apk update WORKDIR /app COPY .gitignore .gitignore COPY --from=builder /app/out/json/ . COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml ENV CYPRESS_INSTALL_BINARY=0 RUN pnpm install COPY --from=builder /app/out/full/ . COPY turbo.json turbo.json RUN pnpm --filter web build FROM base AS runner WORKDIR /app RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs USER nextjs COPY --from=installer /apps/web/next.config.ts . COPY --from=installer /apps/web/package.json . COPY --from=installer --chown=nextjs:nodejs /apps/web/.next/standalone ./ COPY --from=installer --chown=nextjs:nodejs /apps/web/.next/static ./apps/web/.next/static COPY --from=installer --chown=nextjs:nodejs /apps/web/public ./apps/web/public USER nextjs EXPOSE 3000 ENV PORT 3000 ENV HOSTNAME "0.0.0.0" CMD ["node", "apps/web/server.js"]
Dockerfile .dockerignore node_modules **/node_modules npm-debug.log README.md .next .git
docker build -f apps/web/Dockerfile . --no-cache -t superstarter-docker docker run -p 3000:3000 superstarter-docker