mirror of
https://github.com/evroon/bracket.git
synced 2026-01-30 17:11:19 -05:00
Vite is much simpler to use than Next.js and we don't need any of the features Next has that Vite doesn't have. Benefits of moving to Vite are: - Much better performance in dev and prod environments - Much better build times - Actual support for static exports, no vendor lock-in of having to use Vercel - Support for runtime environment variables/loading config from `.env` files - No annoying backwards-incompatible changes on major releases of Next - Better i18n support without having to define getServerSideProps on every page - Better bundle optimization - No opt-out Vercel telemetry Also replaces yarn by pnpm and upgrades mantine to 8.3
48 lines
1.0 KiB
Docker
48 lines
1.0 KiB
Docker
# Install dependencies only when needed
|
|
FROM node:22-alpine AS deps
|
|
|
|
WORKDIR /app
|
|
|
|
COPY pnpm-lock.yaml package.json ./
|
|
|
|
RUN corepack enable && pnpm i
|
|
|
|
# Rebuild the source code only when needed
|
|
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
|
|
RUN corepack enable
|
|
|
|
RUN VITE_API_BASE_URL=http://VITE_API_BASE_URL_PLACEHOLDER \
|
|
VITE_HCAPTCHA_SITE_KEY=VITE_HCAPTCHA_SITE_KEY_PLACEHOLDER \
|
|
pnpm build
|
|
|
|
# Production image, copy all the files and run next
|
|
FROM node:22-alpine AS runner
|
|
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
RUN addgroup -g 1001 --system nodejs && \
|
|
adduser --system vite -u 1001 -G nodejs
|
|
|
|
COPY --from=builder --chown=vite:nodejs /app/public ./public
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app/package.json ./package.json
|
|
|
|
RUN apk add bash
|
|
|
|
USER vite
|
|
|
|
EXPOSE 3000
|
|
|
|
HEALTHCHECK --interval=10s --timeout=5s --retries=5 \
|
|
CMD ["wget", "--spider", "http://0.0.0.0:3000", "||", "exit", "1"]
|
|
|
|
CMD ["pnpm", "start"]
|