chore: prepare docker container for prisma database
All checks were successful
container-scan / Container Scan (pull_request) Successful in 1m54s
docker-build / docker (pull_request) Successful in 3m7s

This commit is contained in:
Dominik 2025-05-19 16:54:50 +02:00 committed by Dominik
parent 29e7d47546
commit 904547b50f
3 changed files with 18 additions and 1 deletions

View file

@ -1,2 +1,7 @@
.next .next
node_modules node_modules
prisma/*.db*
data
README.md
*.env*
.yarn

View file

@ -22,6 +22,8 @@ FROM base AS runner
WORKDIR /app WORKDIR /app
RUN yarn add prisma -D
ENV NODE_ENV=production ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
@ -36,4 +38,4 @@ LABEL org.opencontainers.image.description="A web application for managing meetu
EXPOSE 3000 EXPOSE 3000
ENV HOSTNAME="0.0.0.0" ENV HOSTNAME="0.0.0.0"
CMD ["server.js"] CMD ["/bin/ash", "entrypoint.sh"]

10
entrypoint.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
echo "Running start script with user $(whoami) and NODE_ENV $NODE_ENV"
if [ "$NODE_ENV" == "production" ]; then
if [ -d "prisma/migrations" ]; then
echo "Running Prisma migrations"
npx prisma migrate deploy
fi
fi
exec node server.js