-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.webclient
More file actions
66 lines (56 loc) · 1.43 KB
/
Dockerfile.webclient
File metadata and controls
66 lines (56 loc) · 1.43 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
FROM node:18-alpine
# Install curl for health checks
RUN apk add --no-cache curl
# Set working directory
WORKDIR /app
# Create a simple web client
RUN mkdir -p /app/public /app/src
# Create package.json
RUN echo '{\
"name": "ai-chat-webclient",\
"version": "1.0.0",\
"description": "Web client for AI Chat System",\
"main": "server.js",\
"scripts": {\
"start": "node server.js",\
"build": "echo Build complete"\
},\
"dependencies": {\
"express": "^4.18.2",\
"cors": "^2.8.5"\
}\
}' > package.json
# Install dependencies
RUN npm install
# Create simple web server
RUN echo 'const express = require("express");\
const path = require("path");\
const cors = require("cors");\
\
const app = express();\
const PORT = process.env.PORT || 3000;\
\
app.use(cors());\
app.use(express.static("public"));\
app.use(express.json());\
\
app.get("/", (req, res) => {\
res.sendFile(path.join(__dirname, "public", "index.html"));\
});\
\
app.get("/health", (req, res) => {\
res.json({ status: "healthy", timestamp: new Date().toISOString() });\
});\
\
app.listen(PORT, "0.0.0.0", () => {\
console.log(`Web client running on port ${PORT}`);\
});' > server.js
# Copy the HTML file
COPY public/index.html public/index.html
# Expose port
EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1
# Start the web server
CMD ["npm", "start"]