Skip to content

Commit

Permalink
Improve Docker build support (dirtyjtag#97)
Browse files Browse the repository at this point in the history
* Dockerfile: use Alpine Linux, export artifacts

The Dockerfile has been heavily modified to make full use of docker
build. The operating system has been changed to Alpine Linux, and most
of the old hacks we needed for exporting binaries were removed.

* Update build instructions for docker build

Co-authored-by: Jean THOMAS <virgule@jeanthomas.me>
  • Loading branch information
jeanthom and jeanthom authored Nov 28, 2022
1 parent 2084c3c commit 9525460
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
26 changes: 10 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
FROM debian:jessie-slim
FROM alpine:3.14 as build-stage
MAINTAINER Benjamin Henrion <zoobab@gmail.com>
LABEL Description="DirtyJTAG firmware for STM32 Bluepill board"

RUN DEBIAN_FRONTEND=noninteractive apt-get update -y -q && apt-get install -y -q sudo make python gcc-arm-none-eabi git-core libnewlib-arm-none-eabi
RUN apk add --no-cache make python3 gcc-arm-none-eabi newlib-arm-none-eabi
RUN ln -sf python3 /usr/bin/python

ENV user dirtyjtag
RUN useradd -d /home/$user -m -s /bin/bash $user
RUN echo "$user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$user
RUN chmod 0440 /etc/sudoers.d/$user
ADD . /dirtyjtag
WORKDIR /dirtyjtag

USER $user
WORKDIR /home/$user
RUN mkdir -pv code
COPY . ./code/
RUN sudo chown $user.$user -R /home/$user/code
WORKDIR /home/$user/code/
RUN git submodule init
RUN git submodule sync
RUN git submodule update
RUN make PLATFORM=bluepill
RUN make PLATFORM=stlinkv2
RUN make PLATFORM=stlinkv2dfu
RUN make PLATFORM=baite
RUN make PLATFORM=olimexstm32h103
RUN make PLATFORM=stlinkv2white
RUN make PLATFORM=stlinkv2white

FROM scratch AS export-stage
COPY --from=build-stage /dirtyjtag/src/dirtyjtag.*.bin /
COPY --from=build-stage /dirtyjtag/src/dirtyjtag.*.elf /
8 changes: 7 additions & 1 deletion docs/building-dirtyjtag.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ Once the build is completed, your freshly compiled firmware will be available in

## Docker build

If you have [Docker](https://www.docker.com/) installed on your computer, you can run the `./build.sh` script that will automatically build DirtyJTAG and copy the firmware files out of the container.
If you have [Docker](https://www.docker.com/) (or podman) installed on your computer, you can also choose to build inside a container:

```
docker build https://github.com/jeanthom/DirtyJTAG.git --output type=tar,dest=dirtyjtag.tar
```

At the end of the build process, you'll find a `dirtyjtag.tar` archive containing all the build artifacts.

0 comments on commit 9525460

Please sign in to comment.