/
Containerfile
70 lines (54 loc) · 2.79 KB
/
Containerfile
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
67
68
69
70
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
#ENV RUSTUP_HOME=/opt/rustup
#ENV CARGO_HOME=/opt/cargo
#ENV PATH=/opt/cargo/bin:/opt/rustup/bin:/opt/esp/tools/xtensa-esp32-elf-clang/esp-13.0.0-20211203-x86_64-unknown-linux-gnu/bin/:$PATH
#ENV USER=rust
#ENV IDF_PATH=/opt/.espressif/frameworks/esp-idf-master
#ENV ESP_IDF_TOOLS_INSTALL_DIR=custom:/opt/.espressif
RUN apt-get update \
&& apt-get install -y vim nano git curl gcc ninja-build cmake libudev-dev python3 python3-pip libusb-1.0-0 libssl-dev \
pkg-config libtinfo5
#RUN useradd -c "ESP Rust" rust -d /opt; chown rust:rust /opt
RUN adduser --disabled-password --gecos "" rust
USER rust
WORKDIR /home/rust
COPY install-rust-toolchain.sh .
COPY test-rust-toolchain.sh .
RUN ./install-rust-toolchain.sh --extra-crates "ldproxy cargo-generate" --clear-cache "YES" --export-file /home/rust/export-rust.sh
# RUN ./test-rust-toolchain.sh --extra-crates "ldproxy" --clear-cache "YES" --export-file /home/rust/export-rust.sh
# RUN mkdir -p .espressif/frameworks/; \
# git clone --branch master -q --depth 1 --shallow-submodules --recursive https://github.com/espressif/esp-idf.git .espressif/frameworks/esp-idf-master
# Install esp32 toolchain. Other toolchains: esp32s3, esp32s2, esp32c3, esp32
#ENV IDF_PATH=/opt/.espressif/frameworks/esp-idf-master
#RUN cd .espressif/frameworks/esp-idf-master; \
# ./install.sh esp32
COPY support/esp-rs-rust/entrypoint.sh /opt/esp/entrypoint.sh
COPY support/esp-rs-rust/motd /etc/motd
ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
CMD "/bin/bash"
ENV USER=rust
ENV HOME=/home/rust
# Examples from template
#RUN . /opt/esp/entrypoint.sh \
# && cargo generate --vcs none --git https://github.com/esp-rs/esp-idf-template cargo --name rust-project --define mcu=esp32 --define toolchain=esp --define espidfver=v5.0 --define std=true
# Examples from esp-idf-hal
RUN git clone https://github.com/georgik/esp-idf-hal.git rust-project
# Some patches that should be moved to the tooling
RUN echo '[patch.crates-io] ' >> rust-project/Cargo.toml
RUN echo 'embuild = { git="https://github.com/ivmarkov/embuild.git" }' >> rust-project/Cargo.toml
RUN sed -i -e 's!esp-13.0.0-20211203-aarch64-unknown-linux-gnu/!esp-13.0.0-20211203-aarch64-unknown-linux-gnu/xtensa-esp32-elf-clang/!g' /home/rust/export-rust.sh
#RUN git clone https://github.com/espressif/rust-esp32-example.git
# Compile the example, this will cache .embuild and .espressif including crates
#RUN . /opt/esp/entrypoint.sh \
# && cd rust-project \
# && cargo +esp build --features "native" --release
# Compile esp-idf-hal examples
RUN . /opt/esp/entrypoint.sh \
&& cd rust-project \
&& cargo +esp build --example ledc-simple --release --target xtensa-esp32-espidf
#RUN cd rust-esp32-example \
# && . /opt/esp/entrypoint.sh \
# && idf.py build