Skip to content

Commit 7823829

Browse files
authored
chore: add orchestrator service and add router.deb
1 parent 1cb4771 commit 7823829

File tree

6 files changed

+43
-7
lines changed

6 files changed

+43
-7
lines changed

debian/Dockerfile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
FROM golang:1.24.2 AS go
22

3-
ARG BINARY_NAME="arduino-app-cli"
3+
ARG BINARY_NAME
4+
RUN test -n "${BINARY_NAME}" || (echo "Error: BINARY_NAME is not set" && exit 1)
45

56
COPY . /app
67
WORKDIR /app
7-
RUN GOOS=linux go build -o ${BINARY_NAME} ./cmd/arduino-app-cli/
8+
RUN GOOS=linux go build -o ${BINARY_NAME} ./cmd/${BINARY_NAME}
89

910
FROM debian:bookworm AS debian
1011

1112
ARG VERSION="1.0.0"
1213
ARG REVISION="1"
14+
ARG DEB_NAME
15+
RUN test -n "${DEB_NAME}" || (echo "Error: DEB_NAME is not set" && exit 1)
16+
ARG BINARY_NAME
17+
RUN test -n "${BINARY_NAME}" || (echo "Error: BINARY_NAME is not set" && exit 1)
1318

1419
RUN apt-get update && apt-get install -y sed
1520

16-
COPY ./debian/orchestrator /orchestrator/
17-
COPY --from=go /app/${BINARY_NAME} /orchestrator/usr/bin/${BINARY_NAME}
21+
COPY ./debian/${DEB_NAME} /${DEB_NAME}/
22+
COPY --from=go /app/${BINARY_NAME} /${DEB_NAME}/usr/bin/${BINARY_NAME}
1823

19-
RUN sed -i "s/ARCH/$(dpkg --print-architecture)/" /orchestrator/DEBIAN/control && \
20-
dpkg-deb --build --root-owner-group /orchestrator &&\
21-
mv /orchestrator.deb "/orchestrator_${VERSION}-${REVISION}_$(dpkg --print-architecture).deb"
24+
RUN sed -i "s/ARCH/$(dpkg --print-architecture)/" /${DEB_NAME}/DEBIAN/control && \
25+
dpkg-deb --build --root-owner-group /${DEB_NAME} &&\
26+
mv /${DEB_NAME}.deb "/${DEB_NAME}_${VERSION}-${REVISION}_$(dpkg --print-architecture).deb"
2227

2328
FROM scratch
2429

debian/router/DEBIAN/control

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Package: arduino-router
2+
Version: 1.0
3+
Architecture: ARCH
4+
Maintainer: arduino <support@arduino.cc>
5+
Description: Arduino application router
6+
Depends:
7+

debian/router/DEBIAN/postinst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
systemctl daemon-reload
4+
systemctl enable arduino-router
5+
systemctl start arduino-router

debian/router/DEBIAN/postrm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
systemctl daemon-reload

debian/router/DEBIAN/prerm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
systemctl disable arduino-router
4+
systemctl stop arduino-router
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Arduino Router Service
3+
4+
[Service]
5+
ExecStart=/usr/bin/router --listen-port :8900 --serial-port /dev/ttyACM0
6+
StandardOutput=journal
7+
StandardError=journal
8+
Restart=always
9+
RestartSec=3
10+
11+
[Install]
12+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)