-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
92 lines (70 loc) · 2.29 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
FROM rust:1.84.1-slim-bookworm AS base
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
apt-get update -y && \
apt-get install -y \
build-essential \
ca-certificates \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src
RUN git clone --branch payjoin-0.22.0 https://github.com/payjoin/rust-payjoin.git
WORKDIR /usr/src/rust-payjoin
COPY patches /usr/src/rust-payjoin/patches
RUN git apply patches/*
RUN cargo update -p cc --precise 1.0.105 && \
cargo update -p regex --precise 1.9.6 && \
cargo update -p reqwest --precise 0.12.4 && \
cargo update -p url --precise 2.5.0 && \
cargo update -p tokio --precise 1.38.1 && \
cargo update -p tokio-util --precise 0.7.11 && \
cargo update -p which --precise 4.4.0 && \
cargo update -p zstd-sys --precise 2.0.8+zstd.1.5.5 && \
cargo update -p clap_lex --precise 0.3.0 && \
cargo update -p time --precise 0.3.20
FROM base AS builder-dev
RUN apt-get update && \
apt-get install -y openssl && \
rm -rf /var/lib/apt/lists/*
RUN cargo build --release -p payjoin-cli --features v2,_danger-local-https
RUN cd /tmp && \
openssl req -x509 \
-newkey rsa:2048 \
-keyout /tmp/key.der \
-out /tmp/localhost.der \
-days 365 \
-nodes \
-subj "/CN=localhost" \
-outform DER \
-keyform DER && \
chmod 600 /tmp/key.der && \
chmod 644 /tmp/localhost.der
FROM base AS builder-prod
RUN cargo build --release -p payjoin-cli --features v2
FROM debian:bookworm-slim AS dev
RUN apt-get update && \
apt-get install -y \
procps \
ncat \
jq \
lsof \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder-dev /usr/src/rust-payjoin/target/release/payjoin-cli /usr/local/bin/
COPY --from=builder-dev /tmp/key.der /tmp/
COPY --from=builder-dev /tmp/localhost.der /tmp/
COPY scripts /scripts
RUN chmod +x /scripts/*
EXPOSE 3000 3002 8000
CMD ["/scripts/start.sh"]
FROM debian:bookworm-slim AS prod
RUN apt-get update && \
apt-get install -y \
procps \
ncat \
jq \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder-prod /usr/src/rust-payjoin/target/release/payjoin-cli /usr/local/bin/
COPY scripts /scripts
RUN chmod +x /scripts/*
EXPOSE 3000 8000
CMD ["/scripts/start.sh"]