Skip to content

Commit

Permalink
finish up docker work, i think
Browse files Browse the repository at this point in the history
  • Loading branch information
Knifa committed Nov 29, 2024
1 parent 7d6911c commit ad81377
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
8 changes: 5 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.cache
.vscode
build/
**

!cmake/
!src/
!CMakeLists.txt
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
uses: docker/build-push-action@v6
with:
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm/v7, linux/arm64
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
target: run
32 changes: 16 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
FROM alpine:latest as build

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

RUN apk add --no-cache --virtual .build-deps-base \
RUN apk add --no-cache \
clang \
cmake \
cppzmq \
git \
make \
pkgconf

ENV CC=clang
ENV CXX=clang++
ENV CC="clang"
ENV CXX="clang++"
ENV CFLAGS="-O3"
ENV CXXFLAGS="-O3"
ENV MAKEFLAGS="-j$(nproc)"

RUN mkdir -p /build
WORKDIR /build
RUN mkdir -p /opt/lmz
WORKDIR /opt/lmz

RUN git clone --depth 1 https://github.com/Knifa/rpi-rgb-led-matrix.git
WORKDIR /build/rpi-rgb-led-matrix
RUN cd lib \
RUN git clone --depth 1 https://github.com/knifa/rpi-rgb-led-matrix.git \
&& cd rpi-rgb-led-matrix/lib \
&& make

RUN mkdir -p /build/led-matrix-zmq-server
WORKDIR /build/led-matrix-zmq-server
ADD . .
RUN mkdir -p /opt/lmz/led-matrix-zmq-server
WORKDIR /opt/lmz/led-matrix-zmq-server
COPY . .
RUN mkdir -p build \
&& cd build \
&& cmake -DRPI_RGB_LED_MATRIX_DIR=/build/rpi-rgb-led-matrix .. \
&& cmake -DRPI_RGB_LED_MATRIX_DIR=/opt/lmz/rpi-rgb-led-matrix .. \
&& make


FROM alpine:latest as run

Check warning on line 33 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

RUN apk add --no-cache \
libc++ \
libzmq

RUN mkdir -p /opt/led-matrix-zmq-server
WORKDIR /opt/led-matrix-zmq-server
RUN mkdir -p /opt/lmz
WORKDIR /opt/lmz/

COPY --from=build \
/build/led-matrix-zmq-server/build/led-matrix-zmq-* \
/opt/lmz/led-matrix-zmq-server/build/led-matrix-zmq-* \
./

ENV PATH="/opt/led-matrix-zmq-server:$PATH"
ENV PATH="/opt/lmz:$PATH"
CMD ["echo", "Please run a specific led-matrix-zmq binary!"]
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ A tool for interacting with [rpi-rgb-led-matrix](https://github.com/hzeller/rpi-

## Docker

[A Docker image is available](https://github.com/Knifa/led-matrix-zmq-server/pkgs/container/led-matrix-zmq-server).
A [Docker image](https://github.com/Knifa/led-matrix-zmq-server/pkgs/container/led-matrix-zmq-server) is available for `amd64` and `arm64`.

The server must be run with `--privileged` to allow GPIO access.
The server must be run with `--privileged` to allow GPIO access. This binary is only included in the `arm64` image.

```shell
docker run \
Expand Down Expand Up @@ -61,6 +61,10 @@ sudo ./led-matrix-zmq-server \
# ...etc
```

#### Endpoints

The `--xyz-endpoint` options pass directly through to ZeroMQ, so you can use any valid transport string. For example, you could specify `tcp://0.0.0.0:42069` to listen on the network.

### Sending Frames

The server is a simple ZMQ REQ-REP loop. All you need to do is send your frame as a big ol' byte chunk then wait for an empty message back. Each frame should be in a RGBA32 format.
Expand Down

0 comments on commit ad81377

Please sign in to comment.