-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (27 loc) · 1.09 KB
/
Copy pathDockerfile
File metadata and controls
39 lines (27 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Use the official Node.js LTS (Long Term Support) runtime as a base image
FROM node:lts
# Set the build-time argument for DATABASE_URL
ARG DATABASE_URL
# Set the working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package*.json ./
# Install the dependencies
RUN npm install
# Copy the Prisma schema file and other necessary Prisma files from the src directory
COPY src/prisma ./src/prisma
# Copy the rest of the application code to the working directory
COPY . .
ENV DATABASE_URL=${DATABASE_URL}
# Generate Prisma Client using the schema from the src directory
RUN npx prisma generate --schema=./src/prisma/schema.prisma
# If necessary, run any migrations or push the database schema
RUN npx prisma db push --schema=./src/prisma/schema.prisma
# Set an environment variable for the port
ENV PORT=4001
# Expose the port that the app will run on
EXPOSE 4001
# Command to start the application
CMD npx prisma generate --schema=./src/prisma/schema.prisma && \
npx prisma db push --schema=./src/prisma/schema.prisma && \
npm start