-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
74 lines (57 loc) · 1.31 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
FROM rust:1.66 as planner
WORKDIR /app
RUN cargo install cargo-chef
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM rust:1.66 as cacher
WORKDIR /app
RUN cargo install cargo-chef
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
FROM rust:1.66 as builder
WORKDIR /app
COPY . .
ARG db_key
ENV DATABASE_URL=$db_key
COPY --from=cacher /app/target target
RUN cargo build --release --bin reseda-mesh
FROM ubuntu:latest
RUN \
mkdir /app \
echo "**** install dependencies ****" && \
apt-get update && \
apt-get install -y --no-install-recommends \
libc6 \
sudo \
bc \
build-essential \
curl \
dkms \
git \
gnupg \
ifupdown \
iproute2 \
iptables \
iputils-ping \
jq \
libelf-dev \
net-tools \
openresolv \
perl \
pkg-config \
qrencode \
ca-certificates
COPY --from=builder /app/target/release/reseda-mesh ./app
ARG mesh_key
ARG db_key
ARG cloudflare_key
ENV DATABASE_URL=$db_key
RUN echo "#!/bin/bash\n" \
" echo -e \"DATABASE_URL='$db_key'\nAUTHENTICATION_KEY='$mesh_key'\nCLOUDFLARE_KEY='$cloudflare_key'\" > ./app/.env\n" > script.sh
RUN chmod +x script.sh
RUN ./script.sh
EXPOSE 8443/udp
EXPOSE 80
EXPOSE 443
WORKDIR /app
CMD ["./reseda-mesh"]