2023-01-02 04:59:09 +01:00
|
|
|
FROM --platform=$BUILDPLATFORM alpine:latest as copy
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
RUN case "$TARGETPLATFORM" in \
|
|
|
|
"linux/arm/v7") echo armv7-unknown-linux-gnueabihf > /rust_target.txt ;; \
|
|
|
|
"linux/arm/v6") echo arm-unknown-linux-gnueabihf > /rust_target.txt ;; \
|
|
|
|
"linux/arm64") echo aarch64-unknown-linux-gnu > /rust_target.txt ;; \
|
|
|
|
"linux/amd64") echo x86_64-unknown-linux-gnu > /rust_target.txt ;; \
|
|
|
|
*) exit 1 ;; \
|
|
|
|
esac
|
2020-10-06 14:21:59 +02:00
|
|
|
|
|
|
|
WORKDIR /usr/src/bffh
|
|
|
|
COPY . .
|
2023-01-02 04:59:09 +01:00
|
|
|
RUN cp target/$(cat /rust_target.txt)/release/bffhd ./bffhd.bin
|
2020-10-06 14:21:59 +02:00
|
|
|
|
|
|
|
# Setup deployable image
|
2023-01-02 04:59:09 +01:00
|
|
|
FROM ubuntu:22.04
|
|
|
|
RUN apt-get update && apt-get upgrade -y
|
|
|
|
RUN apt-get install -yqq --no-install-recommends python3 python3-pip
|
|
|
|
RUN pip3 install paho-mqtt
|
|
|
|
COPY --from=copy /usr/src/bffh/bffhd.bin /usr/local/bin/bffhd
|
2020-12-19 21:23:52 +01:00
|
|
|
VOLUME /etc/bffh/
|
2021-09-21 19:17:48 +02:00
|
|
|
VOLUME /var/lib/bffh/
|
|
|
|
VOLUME /usr/local/lib/bffh/adapters/
|
2020-10-06 14:21:59 +02:00
|
|
|
EXPOSE 59661
|
2022-04-26 23:18:50 +02:00
|
|
|
ENTRYPOINT ["sh", "-c", "bffhd -c /etc/bffh/bffh.dhall --load=/etc/bffh/users.toml; bffhd -c /etc/bffh/bffh.dhall"]
|