-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
119 lines (94 loc) · 3.26 KB
/
Dockerfile
File metadata and controls
119 lines (94 loc) · 3.26 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# StormDB v0.4-alpha Dockerfile
# Multi-stage build for StormDB v0.4-alpha with plugin support
# Build stage
FROM golang:1.24-alpine AS builder
# Install build dependencies
RUN apk add --no-cache \
git \
ca-certificates \
tzdata \
make \
gcc \
musl-dev \
binutils-gold \
postgresql-client
# Set working directory
WORKDIR /app
# Copy go mod files first for better caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build plugins first (requires CGO for .so files)
RUN CGO_ENABLED=1 make plugins
# Build the main application
RUN CGO_ENABLED=0 GOOS=linux make build
# Verify builds
RUN ls -la build/ && ls -la build/plugins/
# Runtime stage
FROM alpine:latest
# Install runtime dependencies
RUN apk add --no-cache \
ca-certificates \
tzdata \
postgresql-client \
curl \
jq
# Create app user
RUN addgroup -g 1000 -S stormdb && \
adduser -u 1000 -S stormdb -G stormdb
# Create necessary directories
RUN mkdir -p \
/app/config \
/app/plugins \
/app/data \
/app/logs \
/var/lib/stormdb/plugins && \
chown -R stormdb:stormdb /app /var/lib/stormdb
# Copy binary and plugins from builder
COPY --from=builder /app/build/stormdb /usr/local/bin/stormdb
COPY --from=builder /app/build/plugins/ /var/lib/stormdb/plugins/
# Copy configuration files
COPY --from=builder /app/config/core.yaml /app/config/core.yaml.example
# Copy plugin configurations and documentation
COPY --from=builder /app/plugins/*/config-example.yaml /app/config/plugins/
COPY --from=builder /app/plugins/*/API_EXAMPLES.md /app/docs/
COPY --from=builder /app/*.md /app/docs/
# Create default configuration
RUN cp /app/config/core.yaml.example /app/config/core.yaml
# Set proper permissions
RUN chmod +x /usr/local/bin/stormdb && \
chown -R stormdb:stormdb /app /var/lib/stormdb
# Switch to non-root user
USER stormdb
# Set working directory
WORKDIR /app
# Set environment variables
ENV STORMDB_CONFIG_PATH=/app/config/core.yaml
ENV STORMDB_PLUGIN_DIR=/var/lib/stormdb/plugins
ENV STORMDB_DATA_DIR=/app/data
ENV STORMDB_LOG_DIR=/app/logs
# Expose API port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Default command
ENTRYPOINT ["stormdb"]
CMD ["-config", "/app/config/core.yaml"]
# Build metadata
LABEL maintainer="StormDB Team <team@stormdb.io>"
LABEL version="0.4-alpha"
LABEL description="StormDB v0.4-alpha - Modular PostgreSQL Performance Testing Platform"
LABEL org.opencontainers.image.title="StormDB v0.4-alpha"
LABEL org.opencontainers.image.description="Modular plugin-based database performance testing tool"
LABEL org.opencontainers.image.version="0.4-alpha"
LABEL org.opencontainers.image.source="https://github.com/elchinoo/stormdb"
LABEL org.opencontainers.image.documentation="https://github.com/elchinoo/stormdb/tree/v2-redesign-core"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.vendor="StormDB Team"
LABEL org.opencontainers.image.authors="StormDB Team"
# Architecture and build info
LABEL org.opencontainers.image.architecture="amd64"
LABEL stormdb.plugins.included="bulk-load,tpcc-scalability"
LABEL stormdb.features="plugin-system,rest-api,postgresql-support,metrics-collection"