fix: remove nested .git folders, re-add as normal directories
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
# ---- Stage 1: Install dependencies ----
|
||||
FROM oven/bun:1 AS deps
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun install --frozen-lockfile --production
|
||||
|
||||
# ---- Stage 2: Build ----
|
||||
FROM oven/bun:1 AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy dependency manifests and install all deps (including dev)
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
# Copy source code and supporting files
|
||||
COPY src/ src/
|
||||
COPY prisma/ prisma/
|
||||
COPY prisma.config.ts tsconfig.json ./
|
||||
|
||||
# Generate Prisma client (dummy URL — generate only needs the schema, not a real DB)
|
||||
RUN DATABASE_URL="postgresql://dummy:dummy@localhost:5432/dummy" bunx prisma generate
|
||||
|
||||
# Compile to a standalone executable
|
||||
RUN NODE_ENV=production bun build src/index.ts \
|
||||
--compile \
|
||||
--minify \
|
||||
--target=bun-linux-x64 \
|
||||
--outfile=server
|
||||
|
||||
# ---- Stage 3: Production image ----
|
||||
FROM ubuntu:22.04 AS runtime
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install minimal runtime dependencies (CA certs for HTTPS calls)
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends ca-certificates && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy the compiled binary from the build stage
|
||||
COPY --from=build /app/server ./server
|
||||
|
||||
# Quote PDF branding asset loaded at runtime by pdf generation
|
||||
COPY logo.png ./logo.png
|
||||
|
||||
# Sales tax lookup data loaded by expectedSalesTax at runtime
|
||||
COPY --from=build /app/src/modules/sales-utils/salesTaxRates.json ./salesTaxRates.json
|
||||
|
||||
# Copy Prisma artifacts needed at runtime
|
||||
COPY --from=build /app/generated/ ./generated/
|
||||
COPY --from=build /app/prisma/ ./prisma/
|
||||
COPY --from=build /app/prisma.config.ts ./prisma.config.ts
|
||||
|
||||
# Copy production node_modules (Prisma adapter needs native bindings)
|
||||
COPY --from=deps /app/node_modules/ ./node_modules/
|
||||
|
||||
ENV NODE_ENV=production
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["./server"]
|
||||
|
||||
# ---- Stage 4: Migration runner ----
|
||||
FROM oven/bun:1 AS migration
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
COPY prisma/ prisma/
|
||||
COPY prisma.config.ts ./
|
||||
|
||||
COPY prisma/migrate-entrypoint.sh ./prisma/migrate-entrypoint.sh
|
||||
RUN chmod +x prisma/migrate-entrypoint.sh
|
||||
|
||||
CMD ["sh", "prisma/migrate-entrypoint.sh"]
|
||||
Reference in New Issue
Block a user