FROM golang:1.25.4-bookworm # Install dependencies for telldus-core RUN apt-get update && apt-get install -y \ build-essential \ cmake \ libssl-dev \ libavahi-client-dev \ libglib2.0-dev \ libftdi-dev \ libconfuse-dev \ nodejs \ npm \ && rm -rf /var/lib/apt/lists/* # Build telldus-core COPY ./telldus-core /usr/src/telldus-core WORKDIR /usr/src/telldus-core RUN cmake . \ && make \ && make install \ && ldconfig # Set workdir for the project WORKDIR /go/src/app ENV GO111MODULE=on ENV CGO_ENABLED=1 # Copy source code COPY go.mod . COPY go.sum . # Download dependencies RUN go mod download COPY main.go . COPY telldus ./telldus # Build the Go application RUN go build main.go # Build the frontend COPY frontend ./frontend WORKDIR ./frontend RUN npm install RUN npm run build RUN cp -r dist /go/src/app/ # Set workdir back WORKDIR /go/src/app # Create startup script RUN echo '#!/bin/bash\n\ /usr/local/sbin/telldusd --nodaemon &\n\ TELLDUSD_PID=$!\n\ ./main &\n\ MAIN_PID=$!\n\ trap "kill $MAIN_PID $TELLDUSD_PID; exit" INT TERM\n\ wait $MAIN_PID\n\ kill $TELLDUSD_PID' > start.sh && chmod +x start.sh EXPOSE 8080 # Run the application CMD ["./start.sh"]