maylinejix commited on
Commit
3553300
·
verified ·
1 Parent(s): ff0130c

Create Docker

Browse files
Files changed (1) hide show
  1. Docker +45 -0
Docker ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Node.js LTS version
2
+ FROM node:18-alpine
3
+
4
+ # Install Tesseract OCR dependencies
5
+ RUN apk add --no-cache \
6
+ tesseract-ocr \
7
+ tesseract-ocr-data-eng \
8
+ build-base \
9
+ cairo-dev \
10
+ jpeg-dev \
11
+ pango-dev \
12
+ giflib-dev \
13
+ pixman-dev
14
+
15
+ # Set working directory
16
+ WORKDIR /app
17
+
18
+ # Copy package files
19
+ COPY package*.json ./
20
+
21
+ # Install dependencies
22
+ RUN npm ci --only=production
23
+
24
+ # Copy application files
25
+ COPY . .
26
+
27
+ # Create necessary directories
28
+ RUN mkdir -p uploads public
29
+
30
+ # Set permissions
31
+ RUN chmod -R 755 /app
32
+
33
+ # Expose port
34
+ EXPOSE 7860
35
+
36
+ # Set environment variables
37
+ ENV NODE_ENV=production
38
+ ENV PORT=7860
39
+
40
+ # Health check
41
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
42
+ CMD node -e "require('http').get('http://localhost:3000/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
43
+
44
+ # Start application
45
+ CMD ["node", "index.js"]