forked from Trow-Registry/trow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.release.arm64
71 lines (59 loc) · 2.12 KB
/
Dockerfile.release.arm64
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
#Not a big fan of using nightly, but such is our lot currently
#FROM arm64v8/debian:stable-slim
FROM multiarch/debian-debootstrap:arm64-stretch-slim
RUN apt update && apt install -y curl
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN set -eux; \
\
url="https://static.rust-lang.org/rustup/dist/aarch64-unknown-linux-gnu/rustup-init"; \
wget "$url"; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --default-toolchain nightly; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version;
RUN apt-get update && apt-get install -y cmake golang g++
#RUN rustup target add aarch64-unknown-linux-gnu || true
WORKDIR /usr/src/trow
#First get just the deps
COPY Cargo.toml .
COPY Cargo.lock .
# trow
RUN mkdir src/
RUN echo "fn main() {}" > src/main.rs
# trow-server
COPY lib/server/Cargo.toml lib/server/
RUN mkdir -p lib/server/src
RUN touch lib/server/src/lib.rs
# trow-protobuf
COPY lib/protobuf/Cargo.toml lib/protobuf/
RUN mkdir -p lib/protobuf/src
RUN touch lib/protobuf/src/lib.rs
RUN cargo fetch
COPY src src
COPY lib lib
RUN touch src/main.rs
RUN cargo build --release
FROM scratch
COPY --from=builder /usr/src/trow/target/release/lycaon /lycaon
#Need to copy c libs
#COPY --from=builder /lib/x86_64-linux-gnu/libdl.so.2 /lib/libdl.so.2
#COPY --from=builder /lib/x86_64-linux-gnu/librt.so.1 /lib/librt.so.1
#COPY --from=builder /lib/x86_64-linux-gnu/libpthread.so.0 /lib/libpthread.so.0
#COPY --from=builder /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib/libgcc_s.so.1
#COPY --from=builder /lib/x86_64-linux-gnu/libc.so.6 /lib/libc.so.6
#COPY --from=builder /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
#COPY --from=builder /lib/x86_64-linux-gnu/libm.so.6 /lib/libm.so.6
COPY Rocket.toml /
COPY trow-default.toml /
##Yeah, it's another hack. Sue me. Note that you need 17.09 to build this
COPY --chown=65534:65534 README.md /data/layers/README.md
COPY --chown=65534:65534 README.md /data/scratch/README.md
USER 65534
EXPOSE 8000
ENTRYPOINT ["/trow"]
CMD ["-c", "/trow-default.toml"]