influxdata / flux

Flux is a lightweight scripting language for querying databases (like InfluxDB) and working with data. It's part of InfluxDB 1.7 and 2.0, but can be run independently of those.
https://influxdata.com
MIT License
769 stars 153 forks source link

Building issue #5464

Closed outofsight closed 6 months ago

outofsight commented 8 months ago

I'm trying to setup a building environment in docker container and build flux REPL but unfortunately I'm not succeding because I'm unable to fully understand the preocess and the dependency.

This is the dockerfile I'm sending to docker build.

FROM debian
ARG GOLANG_VERSION=1.22.0
ARG TARGETARCH=amd64

RUN apt-get update && \
    apt-get install -y -qq curl wget clang pkg-config

RUN wget --no-verbose https://go.dev/dl/go${GOLANG_VERSION}.linux-${TARGETARCH}.tar.gz && \
    rm -rf /usr/local/go && tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-${TARGETARCH}.tar.gz && \
    rm go${GOLANG_VERSION}.linux-amd64.tar.gz
ENV PATH="${PATH}:/usr/local/go/bin"

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc

RUN go get github.com/influxdata/pkg-config && \
    go build ./cmd/flux

ENTRYPOINT [ "./flux", "--enable-suggestions" ]

The first error is with the go get.

go: go.mod file not found in current directory or any parent directory.
        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.

Not sure if a go init or go install or a directory change are needed. I tried with a go install github.com/influxdata/pkg-config@latest instead of the go get but at this point the error become:

go: go.mod file not found in current directory or any parent directory; see 'go help modules'

Any help appreciated.

Nocccer commented 8 months ago

First of i would use a docker image that already has golang installed (https://hub.docker.com/_/golang). Second i don't see the step where you clone the flux repository inside the container. Do you mount it with volume? You need to run the go commands in the root of the checkout flux repository.

outofsight commented 8 months ago

Thanks for reply. Unfortunately I'm beginner with all these things. Do you have by change a working dockerfile to build and use flux repl?

Nocccer commented 8 months ago

I don't have one, but the repository seesm to have one: https://github.com/influxdata/flux/blob/master/Dockerfile_build

github-actions[bot] commented 6 months ago

This issue has had no recent activity and will be closed soon.