-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.arm32
66 lines (44 loc) · 1.58 KB
/
Dockerfile.arm32
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
FROM --platform=$BUILDPLATFORM rust:1.50.0-slim-buster AS fetcher
ENV HOME /root
WORKDIR /gatekeeper
RUN cargo init
COPY src src
COPY rust-toolchain .
COPY Cargo.toml .
COPY Cargo.lock .
RUN mkdir -p /gatekeeper/.cargo && cargo vendor > /gatekeeper/.cargo/config
# hadolint ignore=DL3007
FROM --platform=$BUILDPLATFORM balenalib/rpi-raspbian:latest AS builder
ENV HOME /root
WORKDIR /gatekeeper
COPY src src
COPY rust-toolchain .
COPY Cargo.toml .
COPY Cargo.lock .
COPY --from=fetcher /gatekeeper/.cargo /gatekeeper/.cargo
COPY --from=fetcher /gatekeeper/vendor /gatekeeper/vendor
RUN update-ca-certificates -f && \
curl -sSfL https://sh.rustup.rs > rustup.sh && \
sh rustup.sh -y --default-toolchain none --profile minimal && \
rm -f rustup.sh
ENV PATH $HOME/.cargo/bin:$PATH
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential=* && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENV RUSTFLAGS "-Clinker=arm-linux-gnueabihf-gcc"
ARG TARGET=arm-unknown-linux-gnueabihf
RUN rustup target add "$TARGET" && \
cargo build --target "$TARGET" --release --offline && \
cp "target/$TARGET/release/gatekeeperd" /
# hadolint ignore=DL3007
FROM --platform=$TARGETPLATFORM balenalib/rpi-raspbian:latest AS runner
COPY --from=builder /gatekeeperd /
RUN apt-get update && \
apt-get install -y --no-install-recommends avahi-daemon=* dbus=* libnss-mdns=* && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
EXPOSE 1080
ENV RUST_LOG gatekeeper=info
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]