-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (20 loc) · 1.06 KB
/
Copy pathDockerfile
File metadata and controls
28 lines (20 loc) · 1.06 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
# ── Stage 1: Build ────────────────────────────────────────────────────────────
FROM ubuntu:22.04 AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ make \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
COPY protocol.hpp logger.hpp master.cpp worker.cpp ./
RUN g++ -std=c++17 -Wall -Wextra -O2 -pthread -o master master.cpp \
&& g++ -std=c++17 -Wall -Wextra -O2 -pthread -o worker worker.cpp
# ── Stage 2: Runtime ──────────────────────────────────────────────────────────
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /build/master /build/worker ./
COPY client.py ./
EXPOSE 8080
# Default: run master. Override with: docker run <img> ./worker <master-ip>
CMD ["./master"]