-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile.prod
More file actions
66 lines (46 loc) · 1.66 KB
/
dockerfile.prod
File metadata and controls
66 lines (46 loc) · 1.66 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Docker production build file
FROM node:22-alpine AS builder
WORKDIR /app
# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./
# Install pnpm
RUN npm install -g pnpm
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy source code
COPY . .
# Build the application
RUN pnpm build
# Remove development dependencies
RUN pnpm prune --prod
FROM node:22-alpine AS runner
WORKDIR /app
# Set environment to production
ENV NODE_ENV=production
# Install Oracle Instant Client
# RUN apk --no-cache add libaio libc6-compat curl unzip && \
# curl -o instantclient.zip https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip -SL && \
# unzip instantclient.zip && \
# rm instantclient.zip && \
# mv instantclient*/ /instantclient && \
# ln -s /instantclient/libclntsh.so.19.1 /instantclient/libclntsh.so && \
# ln -s /instantclient/libocci.so.19.1 /instantclient/libocci.so && \
# apk add --no-cache bash
ENV LD_LIBRARY_PATH=/instantclient
# Copy from builder stage
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./package.json
# Copy SQL scripts needed for application
# COPY ./sql ./sql
# Create a non-root user to run the application
# RUN addgroup -g 1001 -S nodejs && \
# adduser -S nodejs -u 1001 -G nodejs
# Switch to non-root user
#USER nodejs
# Create a health check script
# COPY ./healthcheck.sh ./healthcheck.sh
# RUN chmod +x ./healthcheck.sh
# Start the application
CMD ["node", "dist/main.js"]
# HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 CMD ./healthcheck.sh todo