56 lines
992 B
Docker
56 lines
992 B
Docker
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
|
|
|
|
EXPOSE 8080
|
|
|
|
# Run the application (it will manage telldusd internally)
|
|
CMD ["./main"] |