Compare commits
2 Commits
62bd8811fa
...
bf60df34ef
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf60df34ef | ||
|
|
84d9ed3a9d |
@ -9,14 +9,13 @@ RUN npx prisma generate && npm run build
|
|||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
RUN mkdir -p /app/uploads && chown node:node /app/uploads
|
RUN mkdir -p /app/uploads && chown node:node /app/uploads
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /app/package*.json ./
|
COPY --chown=node:node --from=builder /app/package*.json ./
|
||||||
COPY --from=builder /app/tsconfig.json ./tsconfig.json
|
COPY --chown=node:node --from=builder /app/tsconfig.json ./tsconfig.json
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --chown=node:node --from=builder /app/node_modules ./node_modules
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --chown=node:node --from=builder /app/dist ./dist
|
||||||
COPY --from=builder /app/prisma ./prisma
|
COPY --chown=node:node --from=builder /app/prisma ./prisma
|
||||||
COPY --from=builder /app/prisma/tsconfig.seed.json ./prisma/tsconfig.seed.json
|
COPY --chown=node:node --from=builder /app/prisma/tsconfig.seed.json ./prisma/tsconfig.seed.json
|
||||||
COPY --from=builder /app/prisma/scientificTerms.ts ./prisma/scientificTerms.ts
|
COPY --chown=node:node --from=builder /app/prisma/scientificTerms.ts ./prisma/scientificTerms.ts
|
||||||
RUN chown -R node:node /app
|
|
||||||
ENV PRISMA_CLI_BINARY_TARGETS=linux-musl-openssl-3.0.x
|
ENV PRISMA_CLI_BINARY_TARGETS=linux-musl-openssl-3.0.x
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
USER node
|
USER node
|
||||||
|
|||||||
@ -499,11 +499,20 @@ export async function main() {
|
|||||||
];
|
];
|
||||||
|
|
||||||
for (const b of blogs) {
|
for (const b of blogs) {
|
||||||
|
try {
|
||||||
await prisma.blog.upsert({
|
await prisma.blog.upsert({
|
||||||
where: { slug: b.slug },
|
where: { slug: b.slug },
|
||||||
update: {},
|
update: {
|
||||||
|
title: b.title,
|
||||||
|
content: b.content,
|
||||||
|
isPublished: b.isPublished,
|
||||||
|
},
|
||||||
create: b,
|
create: b,
|
||||||
});
|
});
|
||||||
|
} catch (err: unknown) {
|
||||||
|
const msg = err instanceof Error ? err.message : String(err);
|
||||||
|
console.warn(`[Seed] Warning upserting blog ${b.slug}:`, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
console.log('Seeded blogs.');
|
console.log('Seeded blogs.');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user