-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathDockerfile.server
More file actions
60 lines (41 loc) · 1.44 KB
/
Dockerfile.server
File metadata and controls
60 lines (41 loc) · 1.44 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
# Dockerfile for building MrRSS server version
# This creates a minimal server binary without GUI dependencies
# Build stage
FROM golang:1.25-alpine AS builder
# Install git, Node.js, and build tools (needed for frontend build and CGO)
RUN apk add --no-cache git nodejs npm gcc musl-dev pkgconfig
# Set working directory
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build frontend
RUN cd frontend && npm install && npm run build
# Build the server version
RUN CGO_ENABLED=1 GOOS=linux go build -tags server -trimpath -buildvcs=false -ldflags="-w -s" -o mrrss-server ./main-core.go
# Runtime stage - minimal alpine image
FROM alpine:latest
# Install ca-certificates for HTTPS requests
RUN apk --no-cache add ca-certificates
# Create a non-root user
RUN adduser -D -s /bin/sh mrrss
# Create data directory with proper permissions
RUN mkdir -p /app/data && chown -R mrrss:mrrss /app/data
# Set working directory
WORKDIR /app
# Copy the binary from builder stage
COPY --from=builder /app/mrrss-server .
# Change ownership
RUN chown mrrss:mrrss mrrss-server
# Switch to non-root user
USER mrrss
# Expose port
EXPOSE 1234
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:1234/api/version || exit 1
# Run the server
CMD ["./mrrss-server", "-host", "0.0.0.0", "-port", "1234"]