Skip to content

Commit dba2543

Browse files
committed
Pull pre-build Docker image for interface.
This removes the need to locally build the interface, making it a lot easier getting started with adding new profiles to this repository.
1 parent e753338 commit dba2543

10 files changed

Lines changed: 125 additions & 25 deletions

File tree

.github/workflows/main.yml

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
name: Install Nix
2222
uses: cachix/install-nix-action@v27
2323
with:
24-
nix_path: nixpkgs=channel:nixos-24.05
24+
nix_path: nixpkgs=channel:nixos-25.11
2525
-
2626
name: Cargo cache
2727
uses: actions/cache@v4
@@ -31,8 +31,76 @@ jobs:
3131
~/.cargo/registry/index/
3232
~/.cargo/registry/cache/
3333
~/.cargo/git/db/
34-
test-runner/target/
34+
interface/target/
3535
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
3636
-
3737
name: Run tests
38-
run: nix-shell --command "make nix-test"
38+
run: nix-shell --command "make test"
39+
40+
dist:
41+
needs: tests
42+
runs-on: ubuntu-latest
43+
if: github.ref == 'refs/heads/master'
44+
steps:
45+
-
46+
name: Checkout
47+
uses: actions/checkout@v4
48+
-
49+
name: Install Nix
50+
uses: cachix/install-nix-action@v27
51+
with:
52+
nix_path: nixpkgs=channel:nixos-25.11
53+
-
54+
name: Cargo cache
55+
uses: actions/cache@v4
56+
with:
57+
path: |
58+
~/.cargo/bin/
59+
~/.cargo/registry/index/
60+
~/.cargo/registry/cache/
61+
~/.cargo/git/db/
62+
interface/target/
63+
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
64+
-
65+
name: Install dev dependencies
66+
run: nix-shell --command "make dev-dependencies"
67+
-
68+
name: Build
69+
run: nix-shell --command "make build"
70+
-
71+
name: Docker meta
72+
id: meta
73+
uses: docker/metadata-action@v5
74+
with:
75+
images: |
76+
chirpstack/${{ github.event.repository.name }}
77+
tags: |
78+
type=raw,value=latest
79+
type=semver,pattern={{version}}
80+
type=semver,pattern={{major}}
81+
type=semver,pattern={{major}}.{{minor}}
82+
-
83+
name: Set up QEMU
84+
uses: docker/setup-qemu-action@v3
85+
-
86+
name: Set up Docker Buildx
87+
uses: docker/setup-buildx-action@v3
88+
-
89+
name: Login to DockerHub
90+
uses: docker/login-action@v3
91+
with:
92+
username: ${{ secrets.DOCKERHUB_USERNAME }}
93+
password: ${{ secrets.DOCKERHUB_TOKEN }}
94+
-
95+
name: Build and push
96+
id: docker_build
97+
uses: docker/build-push-action@v6
98+
with:
99+
context: .
100+
push: true
101+
platforms: linux/amd64
102+
tags: ${{ steps.meta.outputs.tags }}
103+
labels: ${{ steps.meta.outputs.labels }}
104+
-
105+
name: Image digest
106+
run: echo ${{ steps.docker_build.outputs.digest }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# hiddden files
22
.*
33
!.gitignore
4+
!.github
45

56
# builds
67
/interface/target

Dockerfile

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1-
FROM nixos/nix
1+
# Copy binary stage
2+
FROM --platform=$BUILDPLATFORM alpine:3.22.1 AS binary
23

3-
ENV PROJECT_PATH=/lorawan-device-profiles
4-
WORKDIR $PROJECT_PATH
4+
ARG TARGETPLATFORM
55

6-
ENTRYPOINT ["nix-shell"]
6+
COPY interface/target/x86_64-unknown-linux-musl/release/chirpstack-device-profiles-interface /usr/bin/chirpstack-device-profiles-interface-x86_64
7+
8+
RUN case "$TARGETPLATFORM" in \
9+
"linux/amd64") \
10+
cp /usr/bin/chirpstack-device-profiles-interface-x86_64 /usr/bin/chirpstack-device-profiles-interface; \
11+
;; \
12+
esac;
13+
14+
# Final stage
15+
FROM alpine:3.22.1
16+
17+
RUN apk --no-cache add \
18+
ca-certificates
19+
20+
COPY --from=binary /usr/bin/chirpstack-device-profiles-interface /usr/bin/chirpstack-device-profiles-interface
21+
USER nobody:nogroup
22+
ENTRYPOINT ["/usr/bin/chirpstack-device-profiles-interface"]
723

Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
.PHONY: test nix-start nix-test
22

3-
test:
4-
docker compose run --rm lorawan-device-profiles --run 'make nix-test'
3+
serve:
4+
docker pull chirpstack/chirpstack-device-profiles:latest
5+
docker run --rm -p 8090:8090 -v '$(shell pwd):/chirpstack-device-profiles' chirpstack/chirpstack-device-profiles:latest -p /chirpstack-device-profiles
6+
7+
build:
8+
cd interface && make api ui release-amd64
59

6-
nix-start:
7-
cd interface && make ui && cargo run
10+
dev-shell:
11+
nix-shell
812

9-
nix-test:
13+
test:
1014
cd interface && make api ui
1115
cd interface && cargo run run-tests
16+
17+
dev-dependencies:
18+
cargo install cross --git https://github.com/cross-rs/cross --rev c7dee4d008475ce1c140773cbcd6078f4b86c2aa --locked

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# LoRaWAN(R) device-profiles
1+
# ChirpStack device-profiles
22

3-
This repository contains device-profiles for LoRaWAN devices grouped by
3+
This repository contains ChirpStack device-profiles for LoRaWAN devices grouped by
44
vendor. A device-profile contains important information about the capabilities
55
of the device. For example which LoRaWAN mac-version has been implemented,
66
which regions are supported, if the device supports Class-B or Class-C, etc...
@@ -17,7 +17,7 @@ be imported by ChirpStack or potentially any other LNS.
1717
### Starting the web-interface
1818

1919
* Please make sure that you have Docker Compose installed.
20-
* In the root of this repository, execute `docker compose up`.
20+
* In the root of this repository, execute `make serve`.
2121
* Once `Starting server, bind: 0.0.0.0:8090` appears, open the web-interface in your browser by navigating to [http://localhost:8090](http://localhost:8090).
2222

2323
### Add Vendor(s)

docker-compose.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

interface/Cross.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[build]
2+
default-target = "x86_64-unknown-linux-musl"
3+
4+
[target.x86_64-unknown-linux-musl]
5+
dockerfile = "cross/Dockerfile.x86_64-unknown-linux-musl"

interface/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
PROTOC_PATH := ./ui/node_modules/grpc-tools/bin/protoc
44
PROTOC_ARGS := -I=./api --js_out=import_style=commonjs:./api/grpc-web --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:./api/grpc-web/
55

6+
release-amd64:
7+
cross build --target x86_64-unknown-linux-musl --release
8+
69
api:
710
cd ui && yarn install
811

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM ghcr.io/cross-rs/x86_64-unknown-linux-musl:main
2+
3+
RUN apt-get update && \
4+
apt-get --assume-yes install \
5+
protobuf-compiler \
6+
libprotobuf-dev
7+

shell.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ pkgs.mkShell {
88
pkgs.yarn
99
pkgs.protoc-gen-grpc-web
1010
];
11+
shellHook = ''
12+
export PATH=$PATH:~/.cargo/bin
13+
'';
1114
}
12-

0 commit comments

Comments
 (0)