Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# Use Node.js 18 Alpine for smaller image size
FROM node:18-alpine AS base

# Install dependencies only when needed
# Install dependencies and dev dependencies for building
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Copy package files
COPY package.json package-lock.json* ./
RUN npm ci --only=production
RUN npm ci

# Build the source code (JavaScript version)
# Build the TypeScript source code
FROM base AS builder
WORKDIR /app

# Copy source code and dependencies
COPY . .
COPY --from=deps /app/node_modules ./node_modules

# No build needed - we're using plain JavaScript
# Build TypeScript
RUN npm run build

# Production image
FROM base AS runner
Expand All @@ -28,9 +29,8 @@ WORKDIR /app
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 adcp

# Copy application files
COPY --from=builder /app/server.js ./server.js
COPY --from=builder /app/src ./src
# Copy built application files
COPY --from=builder /app/dist ./dist
COPY --from=deps /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

Expand All @@ -49,4 +49,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:8080/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))"

# Start the server
CMD ["node", "server.js"]
CMD ["npm", "start"]
6 changes: 5 additions & 1 deletion fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ primary_region = 'iad'
port = 443
handlers = ['tls', 'http']

[[services.tcp_checks]]
[[services.http_checks]]
interval = '15s'
timeout = '2s'
grace_period = '10s'
method = 'get'
path = '/health'
protocol = 'http'
tls_skip_verify = false

[[vm]]
cpu_kind = 'shared'
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const cors = require('cors');
const { SalesAgentsHandlers } = require('./src/sales-agents-handlers-node');

const app = express();
const port = process.env.PORT || 3000;
const port = process.env.PORT || 8080;

// Middleware
app.use(cors({
Expand Down