optimize container build
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m36s

This commit is contained in:
Shihaam Abdul Rahman 2025-01-10 21:20:33 +05:00
parent fe3161ead9
commit 0e6f405ec4
Signed by: shihaam
GPG Key ID: 6DA2E87EBC227636
3 changed files with 17 additions and 17 deletions

View File

@ -1,29 +1,18 @@
FROM oven/bun:1.1.42-debian AS builder
WORKDIR /var/www/html
ENV NEXT_TELEMETRY_DISABLED=1
ENV DATABASE_URL="postgresql://dummy:dummy@dummy:5432/dummy"
COPY package.json package-lock.json ./
COPY prisma ./prisma/
RUN bun install --frozen-lockfile
RUN bunx prisma generate
COPY . .
RUN bun install --frozen-lockfile
RUN bunx prisma generate
RUN bun run build
FROM oven/bun:1.1.42-debian
WORKDIR /var/www/html
COPY --from=builder /var/www/html/package.json ./
COPY --from=builder /var/www/html/node_modules ./node_modules
COPY --from=builder /var/www/html/.next ./.next
COPY --from=builder /var/www/html/public ./public
COPY --from=builder /var/www/html/prisma ./prisma
VOLUME /var/www/html
CMD bun start
CMD ["bun", "start"]

10
.dockerignore Normal file
View File

@ -0,0 +1,10 @@
.git
.next
node_modules
npm-debug.log
README.md
.env*
.dockerignore
Dockerfile
docker-compose.yml
compose.yml

View File

@ -4,11 +4,12 @@
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "bunx prisma migrate deploy && bunx prisma generate && bunx prisma db push && next build",
"build": "next build",
"start": "next start",
"lint": "next lint",
"studio": "bunx prisma studio",
"push": "bunx prisma db push"
"push": "bunx prisma db push",
"db-setup": "bunx prisma migrate deploy && bunx prisma generate && bunx prisma db push"
},
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
@ -66,4 +67,4 @@
"ts-node": "^10.9.2",
"typescript": "^5.7.2"
}
}
}