forked from autonomys/spartan-farmer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (36 loc) · 1.14 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
FROM ubuntu:20.04
WORKDIR /code
RUN \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gcc \
llvm \
clang \
make \
m4 && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
COPY Cargo.lock /code/Cargo.lock
COPY Cargo.toml /code/Cargo.toml
# Hack to make Cargo download and cache dependencies
RUN \
mkdir src && \
echo "fn main() {}" > src/main.rs && \
/root/.cargo/bin/cargo build --release && \
rm -rf src
COPY src /code/src
RUN \
# TODO: Next line is a workaround for https://github.com/rust-lang/cargo/issues/7969
touch src/main.rs && \
/root/.cargo/bin/cargo test --release && \
/root/.cargo/bin/cargo build --release && \
mv target/release/spartan-farmer spartan-farmer && \
rm -rf target
FROM ubuntu:20.04
COPY --from=0 /code/spartan-farmer /spartan-farmer
ENV SPARTAN_DIR=/var/spartan
RUN mkdir /var/spartan && chown nobody:nogroup /var/spartan
VOLUME /var/spartan
USER nobody:nogroup
ENTRYPOINT ["/spartan-farmer"]