FROM wharf.wamblee.org/alpine:3.20.2 as builder ARG GOPROXY ARG GOSUMDB ENV GOPROXY=$GOPROXY ENV GOSUMDB=$GOSUMDB RUN apk update && apk add go curl RUN mkdir -p /opt/converge/bin # if templ cannot be obtained: quick fix, remove this statement and run make, then build the image. RUN curl -L https://github.com/a-h/templ/releases/download/v0.2.747/templ_Linux_x86_64.tar.gz -o templ.tar.gz && \ tar xvzf templ.tar.gz templ && \ chmod 755 templ && \ mv templ /bin ENV CGO_ENABLED=0 COPY go.mod go.sum /opt/converge/ COPY static /opt/converge/static COPY pkg /opt/converge/pkg COPY cmd /opt/converge/cmd RUN find /opt/converge -type d WORKDIR /opt/converge ENV GOTOOLCHAIN=auto RUN go mod download RUN templ generate RUN go build -o bin ./cmd/... RUN GOOS=windows GOARCH=amd64 go build -o bin ./cmd/... FROM scratch COPY --from=builder /opt/converge/bin/converge /opt/converge/bin/ COPY --from=builder /opt/converge/bin/agent \ /opt/converge/bin/tcptows \ /opt/converge/bin/wsproxy \ /opt/converge/bin/agent.exe \ /opt/converge/bin/tcptows.exe \ /opt/converge/bin/wsproxy.exe \ /opt/converge/static/ COPY --from=builder /opt/converge/static/ /opt/converge/static/ ENTRYPOINT ["/opt/converge/bin/converge", "--static", "/opt/converge/static", "--downloads", "/opt/converge/static" ]