-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (35 loc) · 998 Bytes
/
Dockerfile
File metadata and controls
54 lines (35 loc) · 998 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Frontend build stage
FROM node:20-alpine AS frontend-builder
WORKDIR /app/web
COPY web/package*.json ./
RUN npm ci
COPY web/ ./
RUN npm run build
# Go build stage
FROM golang:1.22-alpine AS builder
RUN apk add --no-cache gcc musl-dev
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Copy frontend build to embed location
COPY --from=frontend-builder /app/web/dist ./internal/frontend/dist
RUN CGO_ENABLED=1 GOOS=linux go build -a -ldflags '-linkmode external -extldflags "-static"' -o whatsbox ./cmd/server
# Runtime stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /app/whatsbox .
# Create data directory
RUN mkdir -p /app/data
# Default environment variables
ENV PORT=3000 \
HOST=0.0.0.0 \
DATABASE_PATH=/app/data/whatsbox.db \
WA_SESSION_PATH=/app/data/wa_session.db \
TEMP_DIR=/app/data/temp \
LOG_LEVEL=info \
LOG_FORMAT=json
EXPOSE 3000
VOLUME ["/app/data"]
CMD ["./whatsbox"]