voxblog/docker/api.Dockerfile
Ender 51999669af
Some checks are pending
Deploy to Production / deploy (push) Waiting to run
feat: add deployment and server configuration files
- Added .dockerignore to exclude unnecessary files from Docker builds
- Enhanced .env.example with detailed configuration options and added MySQL settings
- Created Gitea CI/CD workflow for automated production deployment with health checks
- Added comprehensive Caddy server setup guide and configuration for reverse proxy
- Created Caddyfile with secure defaults for SSL, compression, and security headers

The changes focus on setting up a production-
2025-10-25 23:04:04 +02:00

48 lines
1008 B
Docker

FROM node:18-alpine AS builder
WORKDIR /app
# Copy workspace files
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY apps/api/package.json ./apps/api/
# Install pnpm
RUN npm install -g pnpm
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy source
COPY apps/api ./apps/api
# Production image
FROM node:18-alpine
WORKDIR /app
# Install pnpm and ts-node
RUN npm install -g pnpm ts-node typescript
# Copy package files
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY apps/api/package.json ./apps/api/
# Install production dependencies
RUN pnpm install --frozen-lockfile
# Copy app from builder
COPY --from=builder /app/apps/api ./apps/api
WORKDIR /app/apps/api
# Create data directory
RUN mkdir -p /app/data
EXPOSE 3001
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD node -e "require('http').get('http://localhost:3001/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
CMD ["pnpm", "run", "dev"]