Compare commits
2 Commits
7083c816ec
...
dadf518c2d
| Author | SHA1 | Date | |
|---|---|---|---|
| dadf518c2d | |||
| 98072c6d67 |
@@ -10,7 +10,8 @@ LICENSE
|
|||||||
.vscode
|
.vscode
|
||||||
Makefile
|
Makefile
|
||||||
helm-charts
|
helm-charts
|
||||||
.env
|
.env*.local
|
||||||
|
.vercel
|
||||||
.editorconfig
|
.editorconfig
|
||||||
.idea
|
.idea
|
||||||
coverage*
|
coverage*
|
||||||
|
|||||||
53
Dockerfile
53
Dockerfile
@@ -1,14 +1,61 @@
|
|||||||
# syntax=docker.io/docker/dockerfile:1
|
# syntax=docker.io/docker/dockerfile:1
|
||||||
|
|
||||||
FROM oven/bun:1.2.10 AS base
|
# Use multi-stage build for optimization
|
||||||
|
FROM imbios/bun-node:latest-current-alpine AS base
|
||||||
|
|
||||||
|
# Install dependencies only when needed
|
||||||
|
FROM base AS deps
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files
|
||||||
COPY package.json bun.lock* ./
|
COPY package.json bun.lock* ./
|
||||||
RUN bun install --frozen-lockfile
|
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN bun install --frozen-lockfile --production
|
||||||
|
|
||||||
|
# Rebuild the source code only when needed
|
||||||
|
FROM base AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy dependencies from deps stage
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# Configure Next.js for standalone output
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
|
RUN bun add --exact --dev typescript
|
||||||
|
# Build the application
|
||||||
RUN bun run build
|
RUN bun run build
|
||||||
|
|
||||||
|
# Production image, copy all the files and run next
|
||||||
|
FROM imbios/bun-node:latest-current-alpine AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Create non-root user for security
|
||||||
|
# RUN addgroup --system --gid 1001 nodejs
|
||||||
|
# RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
|
# Copy necessary files from builder stage
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
COPY --from=builder /app/.next/standalone ./
|
||||||
|
COPY --from=builder /app/.next/static ./.next/static
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
ENV PORT=3000
|
||||||
|
ENV HOSTNAME="0.0.0.0"
|
||||||
|
|
||||||
|
# Switch to non-root user
|
||||||
|
USER bun
|
||||||
|
|
||||||
|
# Expose port
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
CMD ["bun", "start"]
|
# Health check
|
||||||
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
||||||
|
CMD bun --version || exit 1
|
||||||
|
|
||||||
|
# Start the application
|
||||||
|
CMD ["bun", "run", "server.js"]
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ const withPWA = require("next-pwa")({
|
|||||||
const nextConfig: NextConfig = withPWA({
|
const nextConfig: NextConfig = withPWA({
|
||||||
/* config options here */
|
/* config options here */
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
// output: "standalone",
|
output: "standalone",
|
||||||
|
images: {
|
||||||
|
formats: ["image/webp", "image/avif"],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
Reference in New Issue
Block a user