-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile.intent_brokering.arm64
57 lines (42 loc) · 1.74 KB
/
Dockerfile.intent_brokering.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
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# SPDX-License-Identifier: MIT
ARG RUST_VERSION=1.70
FROM docker.io/library/rust:${RUST_VERSION} AS builder
# Dockerfile for building Eclipse Chariott Intent Brokering service container
# for ARM64 with cross-compilation.
#
# This Dockerfile utilizes a two step build process. It builds the with
# statically linked dependencies (using musl vs. glibc to accomplish this) for
# a specific architecture such that we can utilize a scratch container without
# further dependencies for our final container, minimizing container size.
# Chariott user id
ARG CHARIOTT_UID=10001
RUN apt update && apt upgrade -y
RUN apt install -y cmake protobuf-compiler gcc-aarch64-linux-gnu
# unprivileged identity to run Chariott Intent Brokering service as
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${CHARIOTT_UID}" \
chariott
WORKDIR /sdv
COPY ./ .
RUN rustup target add aarch64-unknown-linux-musl
RUN cargo build --release --target=aarch64-unknown-linux-musl -p intent_brokering
#############################################################x#######################################
## Final image
####################################################################################################
FROM arm64v8/alpine:latest
# Import Chariott user and group from builder.
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
WORKDIR /sdv
# Copy our build
COPY --from=builder /sdv/target/aarch64-unknown-linux-musl/release/intent_brokering /sdv/intent_brokering
# Use the unprivileged Chariott user during execution.
USER chariott::chariott
CMD ["./intent_brokering"]