-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (29 loc) · 867 Bytes
/
Dockerfile
File metadata and controls
39 lines (29 loc) · 867 Bytes
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
FROM node:20-alpine AS base
WORKDIR /app
# Minimal dependencies to fix the Prisma OpenSSL warning
RUN apk add --no-cache openssl openssl-dev
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY prisma ./prisma
RUN yarn prisma generate
COPY . .
RUN yarn build
RUN cp ./swagger.yaml ./dist
# ---------- Final lightweight image ----------
FROM node:20-alpine AS production
RUN apk add --no-cache openssl
# Create a non-root user
USER node
WORKDIR /api
# Copy only what's needed for production runtime
COPY --from=base --chown=node:node /app/node_modules ./node_modules
COPY --from=base --chown=node:node /app/prisma ./prisma
COPY --from=base --chown=node:node /app/dist ./
# Set environment variables
ENV NODE_ENV=production
ENV ENABLE_TRACING=false
ENV RUST_LOG=info
# Expose app port
EXPOSE 8080
# Start the app
CMD ["node", "index.js"]