File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,22 @@ FROM golang:1.24.2 AS go
22
33ARG BINARY_NAME
44RUN test -n "${BINARY_NAME}" || (echo "Error: BINARY_NAME is not set" && exit 1)
5+ ARG VERSION
6+ RUN test -n "${VERSION}" || (echo "Error: VERSION is not set" && exit 1)
7+ ARG ARCH
8+ RUN test -n "${ARCH}" || (echo "Error: ARCH is not set" && exit 1)
59
610COPY . /app
711WORKDIR /app
8- RUN GOOS=linux go build -o ${BINARY_NAME} ./cmd/${BINARY_NAME}
12+ RUN GOOS=linux GOARCH=${ARCH} go build -ldflags "-X 'main.Version=${VERSION}'" -o ${BINARY_NAME} ./cmd/${BINARY_NAME}
913
1014FROM debian:bookworm AS debian
1115
12- ARG VERSION="1.0.0"
16+ ARG VERSION
17+ RUN test -n "${VERSION}" || (echo "Error: VERSION is not set" && exit 1)
1318ARG REVISION="1"
19+ ARG ARCH
20+ RUN test -n "${ARCH}" || (echo "Error: ARCH is not set" && exit 1)
1421ARG DEB_NAME
1522RUN test -n "${DEB_NAME}" || (echo "Error: DEB_NAME is not set" && exit 1)
1623ARG BINARY_NAME
@@ -21,9 +28,10 @@ RUN apt-get update && apt-get install -y sed
2128COPY ./debian/${DEB_NAME} /${DEB_NAME}/
2229COPY --from=go /app/${BINARY_NAME} /${DEB_NAME}/usr/bin/${BINARY_NAME}
2330
24- RUN sed -i "s/ARCH/$(dpkg --print-architecture)/" /${DEB_NAME}/DEBIAN/control && \
31+ RUN sed -i "s/ARCH/${ARCH}/" /${DEB_NAME}/DEBIAN/control && \
32+ sed -i "s/VERSION/${VERSION}/" /${DEB_NAME}/DEBIAN/control && \
2533 dpkg-deb --build --root-owner-group /${DEB_NAME} &&\
26- mv /${DEB_NAME}.deb "/${DEB_NAME}_${VERSION}-${REVISION}_$(dpkg --print-architecture) .deb"
34+ mv /${DEB_NAME}.deb "/${DEB_NAME}_${VERSION}-${REVISION}_${ARCH} .deb"
2735
2836FROM scratch
2937
Original file line number Diff line number Diff line change 11Package: arduino-router
2- Version: 1.0
2+ Version: VERSION
33Architecture: ARCH
44Maintainer: arduino <support@arduino.cc>
55Description: Arduino application router
You can’t perform that action at this time.
0 commit comments