-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathDockerfile.production
46 lines (34 loc) · 1.02 KB
/
Dockerfile.production
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
# Build stage
FROM node:20.18.0-alpine AS builder
WORKDIR /app
# Install build dependencies
COPY package*.json ./
RUN npm ci
# Copy source code
COPY . .
# Build TypeScript code and create env files
RUN npm run init:copy && npm run init:compile
# Production stage
FROM node:20.18.0-alpine AS production
WORKDIR /app
# Install production dependencies only
COPY package*.json ./
RUN npm ci --only=production
# Copy built files and config files
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/.cliamrc.js ./.cliamrc.js
# Create necessary directories for uploads and logs
RUN mkdir -p ./dist/public/archives \
&& mkdir -p ./dist/public/documents \
&& mkdir -p ./dist/public/images/master-copy \
&& mkdir -p ./dist/public/images/rescale \
&& mkdir -p ./dist/public/audios \
&& mkdir -p ./dist/public/videos \
&& mkdir -p ./dist/logs
# Set environment variables
ENV NODE_ENV=production
ENV PORT=8101
# Expose the port
EXPOSE 8101
# Start the application
CMD ["node", "./dist/api/app.bootstrap.js"]