-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (28 loc) · 960 Bytes
/
Dockerfile
File metadata and controls
35 lines (28 loc) · 960 Bytes
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
FROM ubuntu:latest AS base
# Install dependencies
RUN apt update
RUN apt install -y build-essential curl git wget
RUN apt install -y qemu-system-aarch64 mtools jq
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Copy just ./scripts/
RUN mkdir /moss
WORKDIR /moss
RUN mkdir /moss/scripts
COPY ./scripts /moss/scripts
RUN ./scripts/download-arm-toolchain.sh /tmp/arm-toolchain.tar.xz
RUN mkdir -p /opt/arm-toolchain
RUN tar -xf /tmp/arm-toolchain.tar.xz -C /opt/arm-toolchain --strip-components=1
RUN rm /tmp/arm-toolchain.tar.xz
# Copy the current directory contents into the container at /moss
COPY . /moss
# Install ARM toolchain
ENV PATH="/opt/arm-toolchain/bin:${PATH}"
# Build root fs image
FROM base as image-builder
RUN ./scripts/create-image.sh
# Build final image
FROM base as final
COPY --from=image-builder /moss/moss.img /moss/moss.img
RUN cargo build --release