-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
74 lines (65 loc) · 1.79 KB
/
Dockerfile
File metadata and controls
74 lines (65 loc) · 1.79 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
71
72
73
74
# Build stage
FROM golang:1.24-alpine AS builder
RUN apk add --no-cache git
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum* ./
RUN go mod download
# Copy source code
COPY . .
# Build binary
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o cubeos-hal ./cmd/cubeos-hal
# Swagger UI download stage
FROM alpine:3.19 AS swagger
RUN apk add --no-cache wget
RUN mkdir -p /swagger-ui && \
wget -q -O /swagger-ui/swagger-ui.css "https://unpkg.com/swagger-ui-dist@5.18.2/swagger-ui.css" && \
wget -q -O /swagger-ui/swagger-ui-bundle.js "https://unpkg.com/swagger-ui-dist@5.18.2/swagger-ui-bundle.js" && \
wget -q -O /swagger-ui/swagger-ui-standalone-preset.js "https://unpkg.com/swagger-ui-dist@5.18.2/swagger-ui-standalone-preset.js"
# Runtime stage - use full alpine for tools (iw, ip, iptables, etc.)
FROM alpine:3.19
# Install required tools for hardware control
RUN apk add --no-cache \
# Network tools
iproute2 \
iptables \
ip6tables \
wireless-tools \
iw \
wpa_supplicant \
hostapd \
dhclient \
# VPN tools
wireguard-tools \
openvpn \
# System tools
util-linux \
procps \
coreutils \
# Hardware tools
usbutils \
i2c-tools \
libgpiod \
lm-sensors \
# Storage tools - ADDED for SMART monitoring
smartmontools \
e2fsprogs \
dosfstools \
ntfs-3g \
# Bluetooth tools
bluez \
# Mount tools
cifs-utils \
nfs-utils
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/cubeos-hal .
# Copy Swagger UI assets for offline-first operation
COPY --from=swagger /swagger-ui /app/swagger-ui
# Expose HAL port
EXPOSE 6005
# Health check
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget -q --spider http://127.0.0.1:6005/health || exit 1
# Run HAL
CMD ["./cubeos-hal"]