From 7af3a3491c844bec13be7771f42fca52bcf6a289 Mon Sep 17 00:00:00 2001 From: Philip Johansson Date: Thu, 17 Feb 2022 14:16:05 +0100 Subject: [PATCH] Build in docker --- Docker/Dockerfile | 16 ++++++++++++++++ Docker/docker-compose.yml | 7 +++++++ Docker/readme.md | 5 +++++ Docker/run.sh | 6 ++++++ 4 files changed, 34 insertions(+) create mode 100644 Docker/Dockerfile create mode 100644 Docker/docker-compose.yml create mode 100644 Docker/readme.md create mode 100644 Docker/run.sh diff --git a/Docker/Dockerfile b/Docker/Dockerfile new file mode 100644 index 0000000..5ea3dc5 --- /dev/null +++ b/Docker/Dockerfile @@ -0,0 +1,16 @@ +FROM ubuntu + +COPY ./run.sh /opt/workspace/ +RUN apt update +RUN apt install git python3-pip -y +RUN pip3 install platformio + +RUN mkdir -p /opt/workspace +RUN git clone https://gitea.philsson.com/philip/Hexapod.git /opt/workspace/Hexapod +WORKDIR /opt/workspace/Hexapod +RUN mv include/settings.h.orig include/settings.h; mv include/config.h.orig include/config.h + +RUN pio run -e featheresp32 + +RUN chmod +x /opt/workspace/run.sh; +CMD /opt/workspace/run.sh \ No newline at end of file diff --git a/Docker/docker-compose.yml b/Docker/docker-compose.yml new file mode 100644 index 0000000..fe62238 --- /dev/null +++ b/Docker/docker-compose.yml @@ -0,0 +1,7 @@ +services: + build_project: + build: + context: . + dockerfile: Dockerfile + volumes: + - ./output:/opt/workspace/output diff --git a/Docker/readme.md b/Docker/readme.md new file mode 100644 index 0000000..8da9cd1 --- /dev/null +++ b/Docker/readme.md @@ -0,0 +1,5 @@ +# Build in Docker +Run the following command from this folder +```bash +docker-compose up build_project +``` \ No newline at end of file diff --git a/Docker/run.sh b/Docker/run.sh new file mode 100644 index 0000000..29e2610 --- /dev/null +++ b/Docker/run.sh @@ -0,0 +1,6 @@ +if [ -d "/opt/workspace/output" ]; then + echo "Exporting bin file to /opt/workspace/output..." + cp /opt/workspace/Hexapod/.pio/build/featheresp32/firmware.elf /opt/workspace/output/firmware.elf +else + echo "No output folder exists" +fi \ No newline at end of file