- Created scripts/migrate-sqlite-to-postgres.py as alternative to TypeScript version - Handles all type conversions: timestamps, booleans, and JSONB fields - Successfully migrated all 2,836 rows from SQLite to PostgreSQL - Verified data integrity: all 6 tables migrated correctly - Charts: 1, Candles: 2,592, Annotations: 4, Span annotations: 223
53 lines
1.2 KiB
Docker
53 lines
1.2 KiB
Docker
# Build stage
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install PostgreSQL client for pg module
|
|
RUN apk add --no-cache postgresql-client
|
|
|
|
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
|
|
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
|
# Copy node_modules for dependencies
|
|
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
|
|
|
|
# Copy drizzle migrations
|
|
COPY --from=builder --chown=nextjs:nodejs /app/drizzle ./drizzle
|
|
|
|
# Copy data loading scripts
|
|
COPY --from=builder --chown=nextjs:nodejs /app/scripts ./scripts
|
|
|
|
# Copy initial data CSV
|
|
COPY --from=builder --chown=nextjs:nodejs /app/EURUSD.csv ./EURUSD.csv
|
|
|
|
RUN mkdir -p /app/public && chown -R nextjs:nodejs /app/public
|
|
|
|
# Make startup script executable
|
|
RUN chmod +x /app/scripts/startup.sh
|
|
|
|
ENV NODE_ENV=production PORT=3000 HOSTNAME=0.0.0.0
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1
|
|
|
|
CMD ["/app/scripts/startup.sh"]
|