-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
29 lines (26 loc) · 1007 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
FROM node:20-alpine AS builder
USER node
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY --chown=1000:1000 . .
RUN --mount=type=secret,id=DATABASE_URL,uid=1000 \
env DATABASE_URL=$(cat /run/secrets/DATABASE_URL) \
npx prisma generate --sql --schema=./prisma/schema.prisma
RUN --mount=type=secret,id=DMOB_DATABASE_URL,uid=1000 \
env DMOB_DATABASE_URL=$(cat /run/secrets/DMOB_DATABASE_URL) \
npx prisma generate --sql --schema=./prismaDmob/schema.prisma
RUN npm run build
FROM node:20-alpine AS runner
ENV NODE_ENV=production
USER node
WORKDIR /app
COPY --from=builder --chown=node:node /app/package*.json ./
COPY --from=builder --chown=node:node /app/node_modules/ ./node_modules/
COPY --from=builder --chown=node:node /app/dist/ ./dist/
COPY --from=builder --chown=node:node /app/prisma/ ./prisma/
COPY --from=builder --chown=node:node /app/prismaDmob/ ./prismaDmob/
COPY ci/aws-secret-to-db-url.js ./
COPY ci/runner.sh ./
ENTRYPOINT [ "/app/runner.sh" ]
CMD [ "node", "dist/main.js" ]