# Dockerfile for building the secure stock-nse-india package
FROM node:18-alpine

# Set working directory
WORKDIR /app

# Copy package files
COPY package*.json ./
COPY yarn.lock ./

# Install dependencies
RUN npm install

# Copy source code
COPY . .

# Build the package
RUN npm run build

# Create a simple test to verify the package works
RUN echo 'const { NseIndia } = require("./build/index.js"); console.log("✅ Package loaded successfully"); const nse = new NseIndia(); console.log("✅ NseIndia instance created successfully");' > test-package.js

# Test the package
RUN node test-package.js

# Pack the package for distribution
RUN npm pack

CMD ["sh"]