-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
41 lines (24 loc) · 890 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
31
32
33
34
35
36
37
38
39
40
41
# syntax=docker/dockerfile:1
# --------------------------------------------------------------------
FROM node:20-alpine3.18 AS BUILD_IMAGE
ENV NODE_ENV production
WORKDIR /app
COPY package.json yarn.lock ./
COPY prisma ./prisma
RUN yarn install --production
# --------------------------------------------------------------------
FROM node:20-alpine3.18
ENV NODE_ENV production
ENV PORT 3000
ENV JWT c565bc45-1818-41f3-be52-2b4d11fe959d
ENV DATABASE_URL "postgresql://admin:123@db:5432/tasks?schema=public"
RUN addgroup -g 1001 -S nodejs
RUN adduser -S expressjs -u 1001
WORKDIR /app
COPY --from=BUILD_IMAGE --chown=expressjs:nodejs /app/package.json ./
COPY --from=BUILD_IMAGE --chown=expressjs:nodejs /app/node_modules ./node_modules
COPY .build/src .
RUN yarn prisma generate
USER expressjs
EXPOSE 3000
CMD [ "node", "index.js" ]