-
Notifications
You must be signed in to change notification settings - Fork 199
/
Dockerfile
99 lines (72 loc) · 3.98 KB
/
Dockerfile
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
# Define image base arg
ARG IMAGE_VERSION="ubuntu:22.04"
# Define base image repo name
ARG BASE_IMAGE="ghcr.io/mit-dci/opencbdc-tx-base:latest"
# Create Base Image
FROM $IMAGE_VERSION AS base
# set non-interactive shell
ENV DEBIAN_FRONTEND=noninteractive
ENV CMAKE_BUILD_TYPE=Release
ENV BUILD_RELEASE=1
RUN mkdir -p /opt/tx-processor/scripts
COPY requirements.txt /opt/tx-processor/requirements.txt
COPY scripts/activate-venv.sh /opt/tx-processor/scripts/activate-venv.sh
COPY scripts/install-build-tools.sh /opt/tx-processor/scripts/install-build-tools.sh
COPY scripts/setup-dependencies.sh /opt/tx-processor/scripts/setup-dependencies.sh
# Set working directory
WORKDIR /opt/tx-processor
RUN scripts/install-build-tools.sh
RUN scripts/setup-dependencies.sh
# Create Build Image
FROM $BASE_IMAGE AS builder
# Copy source
COPY . .
# Build binaries
RUN mkdir build && \
cd build && \
cmake -DCMAKE_PREFIX_PATH="prefix" -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} .. && \
make -j$(nproc)
# Create 2PC Deployment Image
FROM $IMAGE_VERSION AS twophase
# Set working directory
WORKDIR /opt/tx-processor
# Only copy essential binaries
COPY --from=builder /opt/tx-processor/build/src/uhs/twophase/sentinel_2pc/sentineld-2pc ./build/src/uhs/twophase/sentinel_2pc/sentineld-2pc
COPY --from=builder /opt/tx-processor/build/src/uhs/twophase/coordinator/coordinatord ./build/src/uhs/twophase/coordinator/coordinatord
COPY --from=builder /opt/tx-processor/build/src/uhs/twophase/locking_shard/locking-shardd ./build/src/uhs/twophase/locking_shard/locking-shardd
COPY --from=builder /opt/tx-processor/build/tools/bench/twophase-gen ./build/tools/bench/twophase-gen
# Copy minimal test transactions script
COPY --from=builder /opt/tx-processor/scripts/test-transaction.sh ./scripts/test-transaction.sh
# Copy Client CLI
COPY --from=builder /opt/tx-processor/build/src/uhs/client/client-cli ./build/src/uhs/client/client-cli
# Copy 2PC config
COPY --from=builder /opt/tx-processor/2pc-compose.cfg ./2pc-compose.cfg
# Create Atomizer Deployment Image
FROM $IMAGE_VERSION AS atomizer
# Set working directory
WORKDIR /opt/tx-processor
# Only copy essential binaries
COPY --from=builder /opt/tx-processor/build/src/uhs/atomizer/atomizer/atomizer-raftd ./build/src/uhs/atomizer/atomizer/atomizer-raftd
COPY --from=builder /opt/tx-processor/build/src/uhs/atomizer/watchtower/watchtowerd ./build/src/uhs/atomizer/watchtower/watchtowerd
COPY --from=builder /opt/tx-processor/build/src/uhs/atomizer/archiver/archiverd ./build/src/uhs/atomizer/archiver/archiverd
COPY --from=builder /opt/tx-processor/build/src/uhs/atomizer/shard/shardd ./build/src/uhs/atomizer/shard/shardd
COPY --from=builder /opt/tx-processor/build/src/uhs/atomizer/sentinel/sentineld ./build/src/uhs/atomizer/sentinel/sentineld
# Copy minimal test transactions script
COPY --from=builder /opt/tx-processor/scripts/test-transaction.sh ./scripts/test-transaction.sh
# Copy Client CLI
COPY --from=builder /opt/tx-processor/build/src/uhs/client/client-cli ./build/src/uhs/client/client-cli
# Copy atomizer config
COPY --from=builder /opt/tx-processor/atomizer-compose.cfg ./atomizer-compose.cfg
# Create PArSEC Deployment Image
FROM $IMAGE_VERSION AS parsec
# Set working directory
WORKDIR /opt/tx-processor
# Only copy essential binaries
COPY --from=builder /opt/tx-processor/build/src/parsec/agent/agentd ./build/src/parsec/agent/agentd
COPY --from=builder /opt/tx-processor/build/src/parsec/runtime_locking_shard/runtime_locking_shardd ./build/src/parsec/runtime_locking_shard/runtime_locking_shardd
COPY --from=builder /opt/tx-processor/build/src/parsec/ticket_machine/ticket_machined ./build/src/parsec/ticket_machine/ticket_machined
# Copy load generators
COPY --from=builder /opt/tx-processor/build/tools/bench/parsec/evm/evm_bench ./build/tools/bench/parsec/evm/evm_bench
COPY --from=builder /opt/tx-processor/build/tools/bench/parsec/lua/lua_bench ./build/tools/bench/parsec/lua/lua_bench
# Copy wait script
COPY --from=builder /opt/tx-processor/scripts/wait-for-it.sh ./scripts/wait-for-it.sh