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
53 changes: 13 additions & 40 deletions Dockerfile.backend
Original file line number Diff line number Diff line change
@@ -1,52 +1,25 @@
# Build stage for the backend service in monorepo
FROM node:22-alpine AS builder

WORKDIR /app

# Copy package files for all workspaces
COPY package*.json ./
COPY packages/shared-schema/package*.json ./packages/shared-schema/
COPY packages/db/package*.json ./packages/db/
COPY packages/aurora-sync/package*.json ./packages/aurora-sync/
COPY packages/backend/package*.json ./packages/backend/

# Install all dependencies (including workspace dependencies)
RUN npm ci

# Copy source code for shared-schema, db, aurora-sync, and backend
COPY packages/shared-schema ./packages/shared-schema
COPY packages/db ./packages/db
COPY packages/aurora-sync ./packages/aurora-sync
COPY packages/backend ./packages/backend

# Build in dependency order: shared-schema -> db -> aurora-sync -> backend
RUN npm run build --workspace=@boardsesh/shared-schema
RUN npm run build --workspace=@boardsesh/db
RUN npm run build --workspace=@boardsesh/aurora-sync
RUN npm run build --workspace=boardsesh-backend

# Production stage
# Backend service - runs TypeScript directly via tsx
FROM node:22-alpine

WORKDIR /app

# Copy package files (need full workspace structure for npm to resolve)
# Copy package files for all workspaces
COPY package*.json ./
COPY packages/shared-schema/package*.json ./packages/shared-schema/
COPY packages/crypto/package*.json ./packages/crypto/
COPY packages/db/package*.json ./packages/db/
COPY packages/aurora-sync/package*.json ./packages/aurora-sync/
COPY packages/backend/package*.json ./packages/backend/

# Copy built shared-schema, db, and aurora-sync dist BEFORE npm ci (so main entry points exist)
COPY --from=builder /app/packages/shared-schema/dist ./packages/shared-schema/dist
COPY --from=builder /app/packages/db/dist ./packages/db/dist
COPY --from=builder /app/packages/aurora-sync/dist ./packages/aurora-sync/dist

# Install production dependencies only
RUN npm ci --omit=dev --workspace=boardsesh-backend --workspace=@boardsesh/shared-schema --workspace=@boardsesh/db --workspace=@boardsesh/aurora-sync
# Copy source code for all shared packages and backend
COPY packages/shared-schema/src ./packages/shared-schema/src
COPY packages/crypto/src ./packages/crypto/src
COPY packages/db/src ./packages/db/src
COPY packages/aurora-sync/src ./packages/aurora-sync/src
COPY packages/backend/src ./packages/backend/src

# Copy built backend files
COPY --from=builder /app/packages/backend/dist ./packages/backend/dist
# Install production dependencies (tsx is now a production dep for running TypeScript)
RUN npm ci --omit=dev --workspace=boardsesh-backend --workspace=@boardsesh/shared-schema --workspace=@boardsesh/crypto --workspace=@boardsesh/db --workspace=@boardsesh/aurora-sync

# Expose port
EXPOSE 8080
Expand All @@ -55,6 +28,6 @@ EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1

# Start the server
# Start the server using tsx to run TypeScript directly
WORKDIR /app/packages/backend
CMD ["node", "dist/index.js"]
CMD ["npx", "tsx", "src/index.ts"]
32 changes: 1 addition & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 22 additions & 5 deletions packages/aurora-sync/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,32 @@
"version": "1.0.0",
"description": "Aurora board sync utility for Boardsesh",
"type": "module",
"main": "dist/index.js",
"main": "src/index.ts",
"types": "src/index.ts",
"bin": {
"aurora-sync": "./dist/cli/index.js"
},
"exports": {
".": "./dist/index.js",
"./runner": "./dist/runner/index.js",
"./api": "./dist/api/index.js",
"./sync": "./dist/sync/index.js"
".": {
"types": "./src/index.ts",
"import": "./src/index.ts",
"default": "./src/index.ts"
},
"./runner": {
"types": "./src/runner/index.ts",
"import": "./src/runner/index.ts",
"default": "./src/runner/index.ts"
},
"./api": {
"types": "./src/api/index.ts",
"import": "./src/api/index.ts",
"default": "./src/api/index.ts"
},
"./sync": {
"types": "./src/sync/index.ts",
"import": "./src/sync/index.ts",
"default": "./src/sync/index.ts"
}
},
"scripts": {
"dev": "tsx watch src/cli/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/aurora-sync/src/api/aurora-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HOST_BASES, AuroraBoardName, LoginResponse, Session, ClientOptions } from './types.js';
import { HOST_BASES, AuroraBoardName, LoginResponse, Session, ClientOptions } from './types';

/**
* Aurora Climbing API Client
Expand Down
10 changes: 5 additions & 5 deletions packages/aurora-sync/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './types.js';
export * from './sync-api-types.js';
export { userSync } from './user-sync-api.js';
export { sharedSync } from './shared-sync-api.js';
export { AuroraClimbingClient } from './aurora-client.js';
export * from './types';
export * from './sync-api-types';
export { userSync } from './user-sync-api';
export { sharedSync } from './shared-sync-api';
export { AuroraClimbingClient } from './aurora-client';
4 changes: 2 additions & 2 deletions packages/aurora-sync/src/api/shared-sync-api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SyncData } from './sync-api-types.js';
import { WEB_HOSTS, SyncOptions, AuroraBoardName, SHARED_SYNC_TABLES } from './types.js';
import { SyncData } from './sync-api-types';
import { WEB_HOSTS, SyncOptions, AuroraBoardName, SHARED_SYNC_TABLES } from './types';

export async function sharedSync(
board: AuroraBoardName,
Expand Down
4 changes: 2 additions & 2 deletions packages/aurora-sync/src/api/user-sync-api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SyncData } from './sync-api-types.js';
import { WEB_HOSTS, SyncOptions, AuroraBoardName } from './types.js';
import { SyncData } from './sync-api-types';
import { WEB_HOSTS, SyncOptions, AuroraBoardName } from './types';

export async function userSync(
board: AuroraBoardName,
Expand Down
Loading
Loading