feat: add Docker support and compile shared package to dist
- Add multi-stage Dockerfile for server containerization - Add .dockerignore to exclude unnecessary files from build context - Switch shared package from source to compiled CommonJS output (dist/) - Server dev/build scripts now build shared package first - Fix deep imports to use @calchat/shared barrel export - Update CLAUDE.md with Docker and shared package documentation
This commit is contained in:
29
apps/server/docker/Dockerfile
Normal file
29
apps/server/docker/Dockerfile
Normal file
@@ -0,0 +1,29 @@
|
||||
FROM node:alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json tsconfig.json ./
|
||||
COPY packages/shared/ packages/shared/
|
||||
COPY apps/server/ apps/server/
|
||||
|
||||
RUN npm ci --workspace=@calchat/server --workspace=@calchat/shared --include-workspace-root
|
||||
|
||||
RUN npm run build --workspace=@calchat/shared && \
|
||||
npm run build --workspace=@calchat/server
|
||||
|
||||
FROM node:alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
COPY packages/shared/package.json packages/shared/
|
||||
COPY apps/server/package.json apps/server/
|
||||
|
||||
RUN npm ci --omit=dev --workspace=@calchat/server --workspace=@calchat/shared --include-workspace-root
|
||||
|
||||
COPY --from=build /app/packages/shared/dist/ packages/shared/dist/
|
||||
COPY --from=build /app/apps/server/dist/ apps/server/dist/
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["node", "apps/server/dist/app.js"]
|
||||
@@ -3,8 +3,8 @@
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "tsx watch src/app.ts",
|
||||
"build": "tsc",
|
||||
"dev": "npm run build --workspace=@calchat/shared && tsx watch src/app.ts",
|
||||
"build": "npm run build --workspace=@calchat/shared && tsc",
|
||||
"start": "node dist/app.js",
|
||||
"test": "jest"
|
||||
},
|
||||
|
||||
@@ -6,9 +6,10 @@ import { CaldavRepository } from "./interfaces/CaldavRepository";
|
||||
import {
|
||||
CalendarEvent,
|
||||
CreateEventDTO,
|
||||
} from "@calchat/shared/src/models/CalendarEvent";
|
||||
CaldavConfig,
|
||||
formatDateKey,
|
||||
} from "@calchat/shared";
|
||||
import { EventService } from "./EventService";
|
||||
import { CaldavConfig, formatDateKey } from "@calchat/shared";
|
||||
|
||||
const logger = createLogger("CaldavService");
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CaldavConfig } from "@calchat/shared/src/models/CaldavConfig";
|
||||
import { CaldavConfig } from "@calchat/shared";
|
||||
|
||||
export interface CaldavRepository {
|
||||
findByUserId(userId: string): Promise<CaldavConfig | null>;
|
||||
|
||||
Reference in New Issue
Block a user