-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (52 loc) 路 1.5 KB
/
Copy pathDockerfile
File metadata and controls
70 lines (52 loc) 路 1.5 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
67
68
69
70
# Grimoire - Local-first bookmark manager
# Multi-stage build for production-ready container
# Build stage
FROM oven/bun:1 AS builder
WORKDIR /app
# Copy package files
COPY package*.json bun.lock* ./
COPY daemon/package*.json daemon/bun.lock* ./daemon/
# Install root dependencies, including build tooling for the frontend bundle
RUN bun install --frozen-lockfile
# Copy source code
COPY . .
# Build frontend
RUN cd daemon && bun install --frozen-lockfile
RUN bun run build
# Production stage
FROM oven/bun:1-slim AS runtime
# Create non-root user
RUN groupadd -r littleimp && useradd -r -g littleimp littleimp
# Install necessary system dependencies
RUN apt-get update && apt-get install -y \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy built application
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/daemon ./daemon
COPY --from=builder /app/package.json ./
# Create data directory
RUN mkdir -p /data && chown littleimp:littleimp /data
# Switch to non-root user
USER littleimp
# Environment variables
ENV HOST=0.0.0.0
ENV PORT=3210
ENV DATA_DIR=/data
ENV XDG_CONFIG_HOME=/data/config
ENV HOME=/data
ENV NODE_ENV=production
ENV LOG_FORMAT=json
ENV LITTLEIMP_IN_CONTAINER=1
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3210/health || exit 1
# Expose port
EXPOSE 3210
# Volume for persistent data
VOLUME ["/data"]
# Start command
CMD ["bun", "run", "daemon:start"]