feat: add Docker configuration
This commit is contained in:
40
.dockerignore
Normal file
40
.dockerignore
Normal file
@@ -0,0 +1,40 @@
|
||||
node_modules
|
||||
|
||||
# output
|
||||
out
|
||||
dist
|
||||
*.tgz
|
||||
.nitro
|
||||
.tanstack
|
||||
.output
|
||||
|
||||
# code coverage
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# logs
|
||||
logs
|
||||
_.log
|
||||
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# caches
|
||||
.eslintcache
|
||||
.cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# IntelliJ based IDEs
|
||||
.idea
|
||||
|
||||
# Finder (MacOS) folder config
|
||||
.DS_Store
|
||||
|
||||
## Panda
|
||||
styled-system
|
||||
styled-system-studio
|
||||
51
Dockerfile
Normal file
51
Dockerfile
Normal 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"]
|
||||
Reference in New Issue
Block a user