forked from georgik/rustzx-esp32
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Containerfile
49 lines (39 loc) · 1.67 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
ARG VARIANT=bullseye
FROM debian:${VARIANT}
ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Arguments
ARG CONTAINER_USER=esp
ARG CONTAINER_GROUP=esp
ARG TOOLCHAIN_VERSION=1.61.0.0
ARG ESP_IDF_VERSION=release/v4.4
ARG ESP_BOARD=esp32
ARG INSTALL_RUST_TOOLCHAIN=install-rust-toolchain.sh
# Install dependencies
RUN apt-get update \
&& apt-get install -y git curl gcc clang ninja-build libudev-dev unzip xz-utils\
python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 libpython2.7 \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# Set users
RUN adduser --disabled-password --gecos "" ${CONTAINER_USER}
USER ${CONTAINER_USER}
WORKDIR /home/${CONTAINER_USER}
# Install Rust toolchain, extra crates and esp-idf
ENV PATH=${PATH}:/home/${CONTAINER_USER}/.cargo/bin:/home/${CONTAINER_USER}/opt/bin
ADD --chown=${CONTAINER_USER}:${CONTAINER_GROUP} \
https://github.com/esp-rs/rust-build/releases/download/v${TOOLCHAIN_VERSION}/${INSTALL_RUST_TOOLCHAIN} \
/home/${CONTAINER_USER}/${INSTALL_RUST_TOOLCHAIN}
RUN chmod a+x ${INSTALL_RUST_TOOLCHAIN} \
&& ./${INSTALL_RUST_TOOLCHAIN} \
--extra-crates "ldproxy cargo-espflash" \
--clear-cache "YES" --export-file /home/${CONTAINER_USER}/export-rust.sh \
--esp-idf-version "release/v4.4" \
--minified-esp-idf "YES" \
--build-target "esp32"
# Install web-flash and wokwi-server
RUN cargo install web-flash --git https://github.com/bjoernQ/esp-web-flash-server \
&& cargo install wokwi-server --git https://github.com/MabezDev/wokwi-server
# Activate ESP environment
RUN echo "source /home/${CONTAINER_USER}/export-rust.sh" >> ~/.bashrc
CMD [ "/bin/bash" ]