|  | 
|  | 1 | +FROM ubuntu:latest AS upstream | 
|  | 2 | + | 
|  | 3 | +ARG DEBIAN_FRONTEND=noninteractive | 
|  | 4 | + | 
|  | 5 | +ENV FILENAME_PREFIX=RTK_Firmware | 
|  | 6 | +ENV FIRMWARE_VERSION_MAJOR=99 | 
|  | 7 | +ENV FIRMWARE_VERSION_MINOR=99 | 
|  | 8 | +ENV CORE_VERSION=2.0.2 | 
|  | 9 | + | 
|  | 10 | +# ESP32 Core Debug Level | 
|  | 11 | +# We use "none" for releases and "error" for release_candidate | 
|  | 12 | +# You may find "verbose" useful while you are debugging your changes | 
|  | 13 | +ENV DEBUG_LEVEL=error | 
|  | 14 | + | 
|  | 15 | +# Developer Mode | 
|  | 16 | +# You may find "true" useful while you are making changes | 
|  | 17 | +# Set to false for releases | 
|  | 18 | +ENV ENABLE_DEVELOPER=true | 
|  | 19 | + | 
|  | 20 | +# If you have your own u-blox PointPerfect token, define it here | 
|  | 21 | +# or pass it in as an arg when building the Dockerfile | 
|  | 22 | +ARG POINTPERFECT_TOKEN=0xAA,0xBB,0xCC,0xDD,0x00,0x11,0x22,0x33,0x0A,0x0B,0x0C,0x0D,0x00,0x01,0x02,0x03 | 
|  | 23 | + | 
|  | 24 | +# Get curl and python3 | 
|  | 25 | +RUN apt-get update \ | 
|  | 26 | +    && apt-get install -y curl python3 python3-pip python3-venv python-is-python3 \ | 
|  | 27 | +    && apt-get clean \ | 
|  | 28 | +    && rm -rf /var/lib/apt/lists/* | 
|  | 29 | + | 
|  | 30 | +# Avoid the externally managed environment constraint | 
|  | 31 | +RUN PYTHON_VER=$(ls /usr/lib | grep python3.) \ | 
|  | 32 | +    && echo "Python version: ${PYTHON_VER}" \ | 
|  | 33 | +    && rm /usr/lib/${PYTHON_VER}/EXTERNALLY-MANAGED | 
|  | 34 | + | 
|  | 35 | +# Install Python dependencies - esptool needs pyserial | 
|  | 36 | +#RUN python3 -m pip install --upgrade pip && \ | 
|  | 37 | +RUN pip install pyserial | 
|  | 38 | + | 
|  | 39 | +# Setup Arduino CLI | 
|  | 40 | +#RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh | 
|  | 41 | +RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh | 
|  | 42 | + | 
|  | 43 | +# Start config file | 
|  | 44 | +RUN arduino-cli config init --additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json,https://espressif.github.io/arduino-esp32/package_esp32_dev_index.json | 
|  | 45 | + | 
|  | 46 | +# Update core index | 
|  | 47 | +RUN arduino-cli core update-index | 
|  | 48 | + | 
|  | 49 | +# Update library index | 
|  | 50 | +RUN arduino-cli lib update-index | 
|  | 51 | + | 
|  | 52 | +# Install platform | 
|  | 53 | +RUN arduino-cli core install "esp32:esp32@${CORE_VERSION}" | 
|  | 54 | + | 
|  | 55 | +# Get Known Libraries | 
|  | 56 | +RUN arduino-cli lib install [email protected] | 
|  | 57 | +RUN arduino-cli lib install [email protected] | 
|  | 58 | +RUN arduino-cli lib install [email protected] | 
|  | 59 | +RUN arduino-cli lib install "ESP32-OTA-Pull"@1.0.0 | 
|  | 60 | +RUN arduino-cli lib install [email protected] | 
|  | 61 | +RUN arduino-cli lib install [email protected] | 
|  | 62 | +RUN arduino-cli lib install [email protected] | 
|  | 63 | +RUN arduino-cli lib install "SdFat"@2.1.1 | 
|  | 64 | +RUN arduino-cli lib install "SparkFun LIS2DH12 Arduino Library"@1.0.3 | 
|  | 65 | +RUN arduino-cli lib install "SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4 | 
|  | 66 | +RUN arduino-cli lib install "SparkFun u-blox GNSS v3"@3.0.14 | 
|  | 67 | +RUN arduino-cli lib install "SparkFun_WebServer_ESP32_W5500"@1.5.5 | 
|  | 68 | +RUN arduino-cli lib install "SparkFun Qwiic OLED Arduino Library"@1.0.13 | 
|  | 69 | +RUN arduino-cli lib install [email protected] | 
|  | 70 | + | 
|  | 71 | +# Enable external libs | 
|  | 72 | +RUN arduino-cli config set library.enable_unsafe_install true | 
|  | 73 | + | 
|  | 74 | +# Get external libs | 
|  | 75 | +RUN arduino-cli lib install --git-url https://github.com/me-no-dev/ESPAsyncWebServer.git | 
|  | 76 | +RUN arduino-cli lib install --git-url https://github.com/me-no-dev/AsyncTCP.git | 
|  | 77 | + | 
|  | 78 | +# Copy RTK_Everywhere into /work and build deployment image | 
|  | 79 | +FROM upstream AS deployment | 
|  | 80 | + | 
|  | 81 | +# Create work directory | 
|  | 82 | +WORKDIR /work | 
|  | 83 | +ADD . . | 
|  | 84 | + | 
|  | 85 | +# Get current date | 
|  | 86 | +#RUN echo "$(date +'%b_%d_%Y')" > date_scores.txt | 
|  | 87 | +#RUN DATE_SCORES=$(cat date_scores.txt) && echo "Date: ${DATE_SCORES}" | 
|  | 88 | +#RUN echo "$(date +'%b %d %Y')" > date_no_scores.txt | 
|  | 89 | +#RUN DATE_NO_SCORES=$(cat date_no_scores.txt) && echo "Date: ${DATE_NO_SCORES}" | 
|  | 90 | + | 
|  | 91 | +# Patch Server.h to avoid https://github.com/arduino-libraries/Ethernet/issues/88#issuecomment-455498941 | 
|  | 92 | +WORKDIR /work/RTK_Surveyor/Patch | 
|  | 93 | +RUN cp Server.h "/root/.arduino15/packages/esp32/hardware/esp32/${CORE_VERSION}/cores/esp32/Server.h" | 
|  | 94 | + | 
|  | 95 | +# Update form.h with index_html and main_js | 
|  | 96 | +WORKDIR /work/Tools | 
|  | 97 | +RUN python index_html_zipper.py ../RTK_Surveyor/AP-Config/index.html ../RTK_Surveyor/form.h | 
|  | 98 | +RUN python main_js_zipper.py ../RTK_Surveyor/AP-Config/src/main.js ../RTK_Surveyor/form.h | 
|  | 99 | + | 
|  | 100 | +# Copy custom app3M_fat9M_16MB.csv | 
|  | 101 | +WORKDIR /work | 
|  | 102 | +RUN cp app3M_fat9M_16MB.csv "/root/.arduino15/packages/esp32/hardware/esp32/${CORE_VERSION}/tools/partitions/app3M_fat9M_16MB.csv" | 
|  | 103 | + | 
|  | 104 | +# Compile Sketch | 
|  | 105 | +WORKDIR /work/RTK_Surveyor | 
|  | 106 | +RUN arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=${DEBUG_LEVEL} \ | 
|  | 107 | +    ./RTK_Surveyor.ino \ | 
|  | 108 | +    --build-property build.partitions=app3M_fat9M_16MB \ | 
|  | 109 | +    --build-property upload.maximum_size=3145728 \ | 
|  | 110 | +    --build-property "compiler.cpp.extra_flags=\"-DPOINTPERFECTTOKEN=${POINTPERFECT_TOKEN}\" \ | 
|  | 111 | +    \"-DFIRMWARE_VERSION_MAJOR=${FIRMWARE_VERSION_MAJOR}\" \ | 
|  | 112 | +    \"-DFIRMWARE_VERSION_MINOR=${FIRMWARE_VERSION_MINOR}\" \ | 
|  | 113 | +    \"-DENABLE_DEVELOPER=${ENABLE_DEVELOPER}\"" \ | 
|  | 114 | +    --export-binaries | 
|  | 115 | + | 
|  | 116 | +# Copy the compile output. List the files | 
|  | 117 | +FROM deployment AS output | 
|  | 118 | +COPY --from=deployment /work/RTK_Surveyor/build/esp32.esp32.esp32 / | 
|  | 119 | +CMD echo $(ls /*.*) | 
0 commit comments