-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (28 loc) · 997 Bytes
/
Dockerfile
File metadata and controls
38 lines (28 loc) · 997 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
# Use Node.js 20 LTS (works on ARM for Raspberry Pi)
FROM node:20-alpine
# Set working directory
WORKDIR /app
# Install build dependencies for better-sqlite3
RUN apk add --no-cache python3 make g++
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production
# Copy application files
COPY server.js .
COPY migrate.js .
COPY templates.json .
COPY public ./public
# Create directory for database with proper permissions
RUN mkdir -p /app/data && \
chown -R node:node /app && \
chmod 700 /app/data
# Switch to non-root user (node user is built into node:alpine, uid 1000)
USER node
# Expose port
EXPOSE 3001
# Health check (HTTPS required for Web Bluetooth)
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('https').get({hostname:'localhost',port:3001,rejectUnauthorized:false},(r)=>{process.exit(r.statusCode===200?0:1)}).on('error',()=>process.exit(1))"
# Start application
CMD ["node", "server.js"]