diff --git a/Dockerfile b/Dockerfile index 71b03ea..007c999 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,7 @@ -FROM node:18-alpine AS builder - -# Create app directory -RUN mkdir -p /app -WORKDIR /app - -# Copy package files first for better caching -COPY package*.json ./ - -# Install dependencies -RUN npm ci --only=production - -# Copy source code -COPY . . - -# Production stage FROM node:18-alpine - -# Create app directory -RUN mkdir -p /app -WORKDIR /app - -# Copy built application from builder stage -COPY --from=builder /app . - -# Create non-root user for security -RUN addgroup -g 1001 -S nodejs && \ - adduser -S nodejs -u 1001 - -# Change ownership of the app directory to nodejs user -RUN chown -R nodejs:nodejs /app -USER nodejs - -# Expose the port the app runs on EXPOSE 8080 - -# Health check -HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ - CMD node -e "require('http').get('http://localhost:8080/', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })" - -# Start the application -CMD ["npm", "start"] +WORKDIR /app +COPY ./package.json . +COPY ./package-lock.json . +RUN npm install +CMD ["npm", "start"] \ No newline at end of file diff --git a/bqexport.js b/bqexport.js index 6b0d681..0e772f5 100644 --- a/bqexport.js +++ b/bqexport.js @@ -9,7 +9,7 @@ const bigquery = new BigQuery({ }); const storage = new Storage({ projectId: process.env.PROJECT_ID || "fynd-jio-commerceml-prod", - credentials: {} + credentials: process.env.GCS_CREDENTIALS || {} }); export const exportMergedJson = async (req, res) => {