-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (41 loc) · 1.19 KB
/
Dockerfile
File metadata and controls
55 lines (41 loc) · 1.19 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
# HFT Voter Registry System - Docker Configuration
# Multi-stage build for production-ready image
FROM ubuntu:22.04 AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
libssl-dev \
pkg-config \
git \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy source code
COPY . .
# Build the project
RUN chmod +x build.sh && ./build.sh --build
# Production stage
FROM ubuntu:22.04 AS production
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -s /bin/bash hftuser
# Set working directory
WORKDIR /app
# Copy built executable and dependencies
COPY --from=builder /app/build/HFTVoterRegistry /app/
COPY --from=builder /app/config/ /app/config/
COPY --from=builder /app/docs/ /app/docs/
# Set permissions
RUN chown -R hftuser:hftuser /app
USER hftuser
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/api/v1/health || exit 1
# Run the application
CMD ["./HFTVoterRegistry", "--api-server"]