add seeding

This commit is contained in:
unurled 2025-02-07 14:36:34 +01:00
parent 2346fe4879
commit 970865c7a4
Signed by: unurled
GPG key ID: EFC5F5E709B47DDD
3 changed files with 21 additions and 7 deletions

View file

@ -1,22 +1,32 @@
FROM oven/bun:alpine FROM docker.io/oven/bun:alpine AS base
ENV NODE_ENV=production
WORKDIR /app WORKDIR /app
RUN chown -R bun:bun /app
USER bun
COPY bun.lock ./ COPY tsconfig.build.json ./
COPY package.json ./
COPY tsconfig.json ./ COPY tsconfig.json ./
COPY package.json ./
COPY bun.lock ./
RUN bun install --production --frozen-lockfile RUN bun install --ignore-scripts --production --frozen-lockfile
FROM base AS builder
COPY prisma ./prisma/ COPY prisma ./prisma/
RUN bunx prisma generate RUN bunx prisma generate
COPY . . COPY . .
ENV NODE_ENV=production
RUN bun run build RUN bun run build
FROM base AS runner
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/prisma ./prisma
EXPOSE 4000 EXPOSE 4000
CMD bunx prisma migrate deploy && bunx prisma db seed && bun run start:prod CMD bun prisma migrate deploy && bun run start:prod

View file

@ -10,8 +10,12 @@
"start": "bun --bun nest start", "start": "bun --bun nest start",
"start:dev": "bun --hot ./src/app.ts", "start:dev": "bun --hot ./src/app.ts",
"start:prod": "bun dist/app", "start:prod": "bun dist/app",
"lint": "eslint .",
"lint:fix": "eslint . --fix" "lint:fix": "eslint . --fix"
}, },
"prisma": {
"seed": "bun ./prisma/seed.ts"
}
"dependencies": { "dependencies": {
"@fastify/helmet": "^13.0.1", "@fastify/helmet": "^13.0.1",
"@fastify/multipart": "^9.0.3", "@fastify/multipart": "^9.0.3",

0
prisma/seed.ts Normal file
View file