-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
30 lines (28 loc) · 982 Bytes
/
Dockerfile
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
FROM node:18 AS dependencies
ENV NODE_ENV=production
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
FROM node:18 AS builder
ENV NODE_ENV=development
WORKDIR /app
COPY . .
COPY --from=dependencies /app/node_modules ./node_modules
RUN yarn prisma generate && yarn build
# Deploy Prisma Migrations to Production db
FROM node:18 AS production
WORKDIR /app
ENV HOST=0.0.0.0
ENV PORT=3000
COPY --chown=node --from=builder /app/next.config.js ./
COPY --chown=node --from=builder /app/public ./public
COPY --chown=node --from=builder /app/.next ./.next
COPY --chown=node --from=builder /app/yarn.lock /app/package.json ./
COPY --chown=node --from=builder /app/node_modules ./node_modules
ENV DATABASE_URL=postgresql://postgres:postgres@postgres:5432/postgres
COPY --chown=node --from=builder /app/prisma ./prisma
COPY --chown=node --from=builder /app/.env ./
COPY --chown=node --from=builder /app/.env.local ./
USER node
EXPOSE 3000
CMD [ "yarn", "start" ]