forked from Azure/iotedge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (40 loc) · 2.02 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 ubuntu:18.04 AS builder
ARG SRC_DIR=.
# Add source code
COPY $SRC_DIR/snitcher /snitcher
RUN sources="$(cat /etc/apt/sources.list | grep -E '^[^#]')" && \
# Update existing repos to be specifically for amd64
echo "$sources" | sed -e 's/^deb /deb [arch=amd64] /g' > /etc/apt/sources.list && \
# Add arm64 repos
echo "$sources" | \
sed -e 's/^deb /deb [arch=arm64] /g' \
-e 's| http://archive.ubuntu.com/ubuntu/ | http://ports.ubuntu.com/ubuntu-ports/ |g' \
-e 's| http://security.ubuntu.com/ubuntu/ | http://ports.ubuntu.com/ubuntu-ports/ |g' \
>> /etc/apt/sources.list && \
dpkg --add-architecture arm64 && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
binutils build-essential ca-certificates cmake curl debhelper dh-systemd file git \
gcc g++ \
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
libcurl4-openssl-dev:arm64 libssl-dev:arm64 uuid-dev:arm64 && \
mkdir -p ~/.cargo && \
echo '[target.aarch64-unknown-linux-gnu]' > ~/.cargo/config && \
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config && \
export AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu && \
export AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include && \
# Install Rust
curl -sSLf https://sh.rustup.rs | sh -s -- -y && \
. ~/.cargo/env && \
rustup target add aarch64-unknown-linux-gnu && \
# Build app
cd /snitcher && \
$HOME/.cargo/bin/cargo build --release --target aarch64-unknown-linux-gnu
# Build real container
# [7/23/2020] Snitcher is on its way to be depricated. The base image is not migrated over to docker.io/azureiotedge
# To whomever wants to update this base image will need to manually build & port over the base image
FROM edgebuilds.azurecr.io/microsoft/snitcher-base:1.0-linux-arm64v8
COPY --from=builder /snitcher/target/aarch64-unknown-linux-gnu/release/snitcher \
/usr/local/bin/
CMD /usr/local/bin/snitcher