File tree Expand file tree Collapse file tree 2 files changed +95
-0
lines changed
Expand file tree Collapse file tree 2 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 1+ FROM messense/rust-musl-cross:x86_64-musl as chef
2+
3+ USER root
4+ RUN cargo install cargo-chef
5+
6+ FROM chef as base
7+
8+ ENV APP_DIR=/usr/run/app
9+ COPY src ${APP_DIR}/src
10+ COPY benches ${APP_DIR}/benches
11+ COPY "Cargo.toml" \
12+ "Cargo.lock" \
13+ ${APP_DIR}/
14+
15+ WORKDIR ${APP_DIR}
16+
17+ FROM base as planner
18+ RUN cargo chef prepare --recipe-path recipe.json
19+
20+ FROM base as builder
21+ COPY --from=planner ${APP_DIR}/recipe.json recipe.json
22+ RUN cargo chef cook --recipe-path recipe.json
23+ RUN cargo build --release --target x86_64-unknown-linux-musl --target-dir ${APP_DIR}/target
24+
25+ FROM scratch as runtime
26+ EXPOSE 80
27+ COPY --from=builder /usr/run/app/target/x86_64-unknown-linux-musl/release/main .
28+ CMD ["./main" ]
Original file line number Diff line number Diff line change 1+ version : " 3.5"
2+ name : " rinha-de-backend"
3+
4+ volumes :
5+ postgres-storage :
6+
7+ services :
8+
9+ load-balancer :
10+ image : nginx:latest
11+ hostname : nginx
12+ volumes :
13+ - config/nginx.conf:/etc/nginx/nginx.conf:ro
14+ depends_on :
15+ - sv-01
16+ - sv-02
17+ privileged : true
18+ ports :
19+ - " 9999:9999"
20+ deploy :
21+ resources :
22+ limits :
23+ cpus : " 0.2"
24+ memory : " 50MB"
25+
26+ sv-01 : &server-base
27+ build : .
28+ expose :
29+ - " 80"
30+ volumes :
31+ - postgres-storage:/var/run/postgresql
32+ deploy :
33+ resources :
34+ limits :
35+ cpus : " 0.25"
36+ memory : " 50MB"
37+
38+ sv-02 :
39+ << : *server-base
40+
41+ db :
42+ image : postgres:latest
43+ hostname : db
44+ environment :
45+ POSTGRES_USER : rinha
46+ POSTGRES_PASSWORD : inha
47+ POSTGRES_DB : rinhadb
48+ ports :
49+ - " 12345:5432"
50+ volumes :
51+ - postgres-storage:/var/run/postgresql
52+ healthcheck :
53+ test : [ "CMD-SHELL", "pg_isready" ]
54+ interval : 5s
55+ timeout : 5s
56+ retries : 10
57+ start_period : 10s
58+ deploy :
59+ resources :
60+ limits :
61+ cpus : " 0.8"
62+ memory : " 400mb"
63+
64+ networks :
65+ default :
66+ driver : bridge
67+ name : rinha-proxy
You can’t perform that action at this time.
0 commit comments