Skip to content

Commit

Permalink
chore: remove minification for backend and auth-service
Browse files Browse the repository at this point in the history
  • Loading branch information
mohebifar committed Dec 22, 2024
1 parent d971b78 commit 2acd600
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
3 changes: 2 additions & 1 deletion apps/auth-service/esbuild.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ esbuild
.build({
entryPoints: ["src/index.ts"],
bundle: true,
minify: true,
minify: false,
sourcemap: true,
platform: "node",
outfile: "build/index.js",
banner: {
Expand Down
24 changes: 19 additions & 5 deletions apps/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-alpine3.16 as base
FROM node:20.18-alpine as base

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
Expand Down Expand Up @@ -31,16 +31,30 @@ 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=builder /app/node_modules/.pnpm/@[email protected][email protected]/node_modules/.prisma/ ./node_modules/.pnpm/@[email protected][email protected]/node_modules/.prisma/
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=builder /app/apps/backend ./apps/backend
COPY --from=builder /app/packages/database ./packages/database
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

12 changes: 1 addition & 11 deletions apps/backend/esbuild.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,9 @@ esbuild
.build({
entryPoints: ["src/index.ts"],
bundle: true,
minify: true,
minify: false,
platform: "node",
outfile: "build/index.js",
banner: {
js: `
import { createRequire } from 'module';
import { fileURLToPath, URL } from 'url';
import path from 'path';
const require = createRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
`,
},
format: "esm",
})
.catch(() => process.exit(1));

0 comments on commit 2acd600

Please sign in to comment.