-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (33 loc) · 1.38 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
FROM --platform=$BUILDPLATFORM rust:1.69 as builder
ENV CARGO_TERM_COLOR=always \
CARGO_NET_GIT_FETCH_WITH_CLI=true
WORKDIR /app
ARG BUILDPLATFORM
RUN echo "BUILDPLATFORM: $BUILDPLATFORM"
ARG TARGETPLATFORM
RUN echo "TARGETPLATFORM: $TARGETPLATFORM"
RUN mkdir -p .cargo ; \
echo '[build]' > .cargo/config.toml ; \
case "$TARGETPLATFORM" in \
"linux/amd64") \
echo 'target = "x86_64-unknown-linux-gnu"' >> .cargo/config.toml \
;; \
"linux/arm64") \
echo 'target = "aarch64-unknown-linux-gnu"' >> .cargo/config.toml \
;; \
esac ; \
cat .cargo/config.toml
RUN apt update && apt install --assume-yes --no-install-recommends g++-aarch64-linux-gnu libc6-dev-arm64-cross libudev-dev
RUN rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
RUN rustup toolchain install stable-aarch64-unknown-linux-gnu
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc \
CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ \
PKG_CONFIG_PATH="/usr/lib/aarch64-linux-gnu/pkgconfig/:${PKG_CONFIG_PATH}"
COPY . .
RUN cargo install --path . --root /usr/local
FROM debian:bullseye-slim AS runtime
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
WORKDIR /app
COPY --from=builder /usr/local/bin/jarvis-tp-link-hs-110-exporter .
ENTRYPOINT ["./jarvis-tp-link-hs-110-exporter"]