diff --git a/backend/services/mpc-service/Dockerfile b/backend/services/mpc-service/Dockerfile index 3f00fcf0..29f52e6c 100644 --- a/backend/services/mpc-service/Dockerfile +++ b/backend/services/mpc-service/Dockerfile @@ -2,7 +2,7 @@ # MPC Party Service Dockerfile # ============================================================================= -# Build stage +# Build stage - use Alpine for smaller build context FROM node:20-alpine AS builder WORKDIR /app @@ -25,13 +25,19 @@ COPY src ./src # Build TypeScript RUN npm run build -# Production stage -FROM node:20-alpine +# Verify build output exists +RUN ls -la dist/ && test -f dist/main.js + +# Production stage - use Debian slim for OpenSSL compatibility +FROM node:20-slim WORKDIR /app -# Install OpenSSL for Prisma (Alpine 3.22 uses OpenSSL 3) -RUN apk add --no-cache openssl +# Install OpenSSL and curl for health checks +RUN apt-get update && apt-get install -y --no-install-recommends \ + openssl \ + curl \ + && rm -rf /var/lib/apt/lists/* # Install production dependencies only COPY package*.json ./ @@ -39,14 +45,14 @@ RUN npm ci --only=production # Copy Prisma schema and generate client COPY prisma ./prisma/ -RUN npx prisma generate +RUN DATABASE_URL="postgresql://user:pass@localhost:5432/db" npx prisma generate # Copy built files COPY --from=builder /app/dist ./dist # Create non-root user -RUN addgroup -g 1001 -S nodejs && \ - adduser -S nestjs -u 1001 +RUN groupadd -g 1001 nodejs && \ + useradd -u 1001 -g nodejs nestjs # Create temp directory for TSS RUN mkdir -p /tmp/tss && chown -R nestjs:nodejs /tmp/tss @@ -59,7 +65,7 @@ EXPOSE 3006 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \ - CMD node -e "require('http').get('http://localhost:3006/api/v1/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})" + CMD curl -f http://localhost:3006/api/v1/health || exit 1 # Start service CMD ["node", "dist/main.js"]