-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (37 loc) · 1015 Bytes
/
Dockerfile
File metadata and controls
52 lines (37 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
FROM oven/bun:1-alpine AS base
# Install system dependencies
RUN apk add --no-cache \
postgresql16-client \
mysql-client \
gzip \
curl
# Build stage
FROM base AS builder
WORKDIR /app
# Copy package files
COPY package.json bun.lockb ./
# Install dependencies
RUN bun install --frozen-lockfile
# Copy source code
COPY . .
# Build Next.js application
RUN bun run build
# Production stage
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
# Create user
RUN addgroup --system --gid 1001 bunuser && \
adduser --system --uid 1001 nextjs
# Copy built application
COPY --from=builder --chown=nextjs:bunuser /app/.next/standalone ./
COPY --from=builder --chown=nextjs:bunuser /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:bunuser /app/public ./public
# Create directories for data
RUN mkdir -p /app/data/backups /app/data/db && \
chown -R nextjs:bunuser /app/data
USER nextjs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["bun", "run", "server.js"]