feat: add Docker configuration

This commit is contained in:
2026-03-09 14:13:23 -06:00
parent 19191eac7c
commit a6642bc2cc
2 changed files with 91 additions and 0 deletions

51
Dockerfile Normal file
View File

@@ -0,0 +1,51 @@
FROM oven/bun:1.3.10-alpine AS base
# Add metadata labels
LABEL maintainer="jugger@srjuggernaut.dev"
LABEL description="Blog application built with TanStack Start"
FROM base AS builder
WORKDIR /app
COPY . .
# Set proper environment
ENV BUILD=true
# Install all dependencies for build (dev + prod)
RUN bun install --frozen-lockfile
RUN bun run build
FROM base AS installer
WORKDIR /app
COPY . .
# Set proper environment
ENV NODE_ENV=production
# Install all dependencies for production
RUN bun install --frozen-lockfile --production
FROM base AS runner
WORKDIR /app
# Install curl for health checks
RUN apk add --no-cache curl
COPY --from=installer /app/node_modules /app/node_modules
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/server.ts /app/server.ts
ENV NODE_ENV=production
EXPOSE 3000/tcp
# Add health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3000/ || exit 1
CMD ["bun", "server.ts"]