-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Use tsup for building backend
- Loading branch information
Showing
5 changed files
with
202 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,7 @@ ENV PATH="$PNPM_HOME:$PATH" | |
RUN npm install -g pnpm@latest | ||
RUN pnpm -g add turbo@^1 | ||
|
||
|
||
|
||
FROM base AS builder | ||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
RUN apk update | ||
|
@@ -31,30 +29,7 @@ COPY packages/auth /app/packages/auth/ | |
|
||
RUN turbo prune @codemod-com/backend --docker | ||
|
||
|
||
|
||
FROM base AS installer | ||
WORKDIR /app | ||
|
||
RUN apk update | ||
RUN apk add --no-cache libc6-compat | ||
|
||
# First install the dependencies (as they change less often) | ||
COPY --from=builder /app/out/json/ . | ||
RUN pnpm install | ||
|
||
# Build the project | ||
COPY --from=builder /app/out/full/ . | ||
RUN pnpm build --filter @codemod-com/backend | ||
|
||
|
||
|
||
FROM base AS runner | ||
# Copy stuff for prisma to work | ||
COPY --from=installer /app/node_modules/.pnpm/@[email protected][email protected]/node_modules/.prisma/ ./node_modules/.pnpm/@[email protected][email protected]/node_modules/.prisma/ | ||
|
||
WORKDIR /app | ||
COPY --from=installer /app/apps/backend ./apps/backend | ||
COPY --from=installer /app/packages/database ./packages/database | ||
|
||
CMD cd packages/database && pnpm dlx prisma@latest migrate deploy && cd - && node apps/backend/build/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import "dotenv/config"; | ||
|
||
import { startCronJobs } from "./cron.js"; | ||
import { runServer } from "./server.js"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineConfig } from "tsup"; | ||
|
||
export default defineConfig({ | ||
entryPoints: ["src/index.ts"], | ||
format: ["esm"], | ||
dts: false, | ||
sourcemap: true, | ||
clean: true, | ||
minify: false, | ||
splitting: true, | ||
target: "node20", | ||
bundle: true, | ||
outDir: "build", | ||
}); |
Oops, something went wrong.