-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (48 loc) · 1.61 KB
/
Dockerfile
File metadata and controls
66 lines (48 loc) · 1.61 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
# Multi-stage build for Chromap with overflow system
# Stage 1: Build environment
FROM debian:trixie-slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
g++ \
make \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /build
# Copy source code
COPY . .
# Build Chromap with overflow system enabled
RUN make clean && make NEW_OVERFLOW=1 -j$(nproc)
# Verify the binary was built successfully
RUN ls -la chromap && ./chromap --help | head -5
# Stage 2: Runtime environment
FROM debian:trixie-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
zlib1g \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Create dedicated temp directory with proper permissions
RUN mkdir -p /chromap-temp && chmod 1777 /chromap-temp
# Set Chromap-specific temp directory environment variable
ENV CHROMAP_TEMP_DIR=/chromap-temp
# Copy the compiled binary from builder stage
COPY --from=builder /build/chromap /usr/local/bin/chromap
# Make binary executable
RUN chmod +x /usr/local/bin/chromap
# Create a non-root user for security
RUN useradd -r -s /bin/false chromap
# Set working directory
WORKDIR /data
# Create volume mount point for temp directory (optional)
VOLUME ["/chromap-temp"]
# Test that the binary works
RUN chromap --help | head -5
# Default command
CMD ["chromap", "--help"]
# Stage 3: Binary export stage (for extracting the binary)
FROM scratch AS export
COPY --from=builder /build/chromap /chromap
# Default stage is runtime (this must be last for docker build without --target)
FROM runtime