I'm new to using Prisma as well as Dockerizing my setup. I would like to specify my data model using Prisma, have Postgres as my database and use that in a GraphQL API (my current API uses apollo-server-express) that also deals with authentication and roles etc.
What I have now is a simple docker-compose.yml and a Dockerfile of my GraphQL API:
docker-compose.yml
services:
api:
build: ./api
env_file:
- .env
volumes:
- ./api:/usr/src/app
ports:
- ${API_PORT}:${API_PORT}
command: npm start
Dockerfile
# Latest LTS version
FROM node:14
# Set default values for environment variables
ENV API_PORT=3001
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
COPY package*.json ./
RUN npm install
# Bundle app source
COPY . .
# Bind port
EXPOSE ${API_PORT}
# Start server
CMD ["npm", "start"]
How would I go about using Prisma and Postgres in this setup, where the migrations happen in some containerized way, instead of me executing a Prisma command manually in the CLI?
Pointing out my misconceptions, hints or feedback is appreciated! Thank you