mirror of
https://github.com/Leado123/sharesyllabus-server.git
synced 2026-10-01 00:13:00 +00:00
eeee
This commit is contained in:
+14
-21
@@ -2,34 +2,27 @@
|
|||||||
FROM oven/bun:1 AS base
|
FROM oven/bun:1 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install dependencies into a temp directory for caching
|
# Install dependencies
|
||||||
FROM base AS install
|
FROM base AS install
|
||||||
RUN mkdir -p /temp/dev
|
COPY package.json bun.lockb* ./
|
||||||
COPY package.json bun.lockb /temp/dev/
|
RUN bun install
|
||||||
RUN cd /temp/dev && bun install --frozen-lockfile
|
|
||||||
|
|
||||||
# Install production dependencies only
|
# Copy source files and generate Prisma client
|
||||||
RUN mkdir -p /temp/prod
|
FROM base AS build
|
||||||
COPY package.json bun.lockb /temp/prod/
|
COPY --from=install /app/node_modules ./node_modules
|
||||||
RUN cd /temp/prod && bun install --frozen-lockfile --production
|
|
||||||
|
|
||||||
# Copy node_modules from temp directory and all source files
|
|
||||||
FROM base AS prerelease
|
|
||||||
COPY --from=install /temp/dev/node_modules node_modules
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Generate Prisma client
|
|
||||||
RUN bunx prisma generate
|
RUN bunx prisma generate
|
||||||
|
|
||||||
# Final production image
|
# Final production image
|
||||||
FROM base AS release
|
FROM base AS release
|
||||||
COPY --from=install /temp/prod/node_modules node_modules
|
WORKDIR /app
|
||||||
COPY --from=prerelease /app/src ./src
|
|
||||||
COPY --from=prerelease /app/prisma ./prisma
|
# Copy necessary files from build stage
|
||||||
COPY --from=prerelease /app/package.json .
|
COPY --from=build /app/node_modules ./node_modules
|
||||||
COPY --from=prerelease /app/tsconfig.json .
|
COPY --from=build /app/src ./src
|
||||||
COPY --from=prerelease /app/node_modules/.prisma ./node_modules/.prisma
|
COPY --from=build /app/prisma ./prisma
|
||||||
COPY --from=prerelease /app/node_modules/@prisma ./node_modules/@prisma
|
COPY --from=build /app/package.json ./
|
||||||
|
COPY --from=build /app/tsconfig.json ./
|
||||||
|
|
||||||
# Create syllabi directory for file uploads
|
# Create syllabi directory for file uploads
|
||||||
RUN mkdir -p /app/syllabi
|
RUN mkdir -p /app/syllabi
|
||||||
|
|||||||
Reference in New Issue
Block a user