qb1t
qb1t
Explore posts from servers
PPrisma
Created by qb1t on 9/30/2024 in #help-and-questions
Correct way to setup prisma + docker
(I am new to prisma this is my first project using it) Hi I am currently trying to dockerise one of my typescript apps (discord bot) which is using prisma with sqlite database. I am in the middle of writing the dockerfile This is it so far:
FROM node:18-alpine

# Set the working directory inside the container
WORKDIR /usr/src/app

# Copy package.json and package-lock.json to the working directory
COPY package.json package-lock.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application files
COPY . .

# Build the TypeScript code
RUN npm run build

# Prisma needs to generate the client
RUN npx prisma generate

# Run the bot using the built JavaScript file
CMD ["npm", "run", "start"]
FROM node:18-alpine

# Set the working directory inside the container
WORKDIR /usr/src/app

# Copy package.json and package-lock.json to the working directory
COPY package.json package-lock.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application files
COPY . .

# Build the TypeScript code
RUN npm run build

# Prisma needs to generate the client
RUN npx prisma generate

# Run the bot using the built JavaScript file
CMD ["npm", "run", "start"]
My question is what is the proper way to set up migrations or something so that when I push a new version of the scheme.prisma the database automatically gets updated without wiping current data. The sqlite database is persistent across the container builds.
7 replies