Initial commit

This commit is contained in:
Markus Thielker 2025-07-24 15:08:39 +02:00
commit d9cff2e70c
72 changed files with 2878 additions and 0 deletions

View file

@ -0,0 +1,61 @@
# Stage 1: Builder
# This stage installs all dependencies and builds all packages.
FROM oven/bun:1 AS builder
WORKDIR /app
# Copy dependency manifests
COPY package.json bun.lock ./
COPY tsconfig.base.json ./
# Copy package-specific manifests to leverage Docker cache
COPY packages/shared/package.json packages/shared/tsconfig.json ./packages/shared/
COPY packages/server/package.json packages/server/tsconfig.json ./packages/server/
# Install ALL workspace dependencies
RUN bun install
# Copy source code
COPY packages/shared ./packages/shared/
COPY packages/server ./packages/server/
# Build the server and its dependencies (i.e., 'shared')
RUN bun run --filter=@hnu.de/hl7v2-shared build
RUN bun run --filter=@hnu.de/hl7v2-server build
#---------------------------------------------------------------------
# Stage 2: Production
FROM oven/bun:1-slim
WORKDIR /app
# Create the full directory structure first
RUN mkdir -p packages/shared packages/server
# Copy workspace configuration
COPY --from=builder /app/package.json /app/bun.lock ./
# Set up shared package with its dist directory
COPY --from=builder /app/packages/shared/package.json ./packages/shared/
COPY --from=builder /app/packages/shared/dist ./packages/shared/dist
# Set up server package with its dist directory
COPY --from=builder /app/packages/server/package.json ./packages/server/
COPY --from=builder /app/packages/server/dist ./packages/server/dist
# Install ONLY production dependencies
ENV NODE_ENV=production
RUN bun install \
--frozen-lockfile \
--production
# Set environment variables from config.ts
ENV PORT=8080 \
PREFIXES=STA \
POOL_SIZE=100
EXPOSE 8080
# Run the server from its package directory
WORKDIR /app/packages/server
CMD ["bun", "run", "dist/index.js"]