Closed sabberworm closed 2 years ago
I actually don't use Docker personally, so I don't have much opinion on how to write the Dockerfile. If you want to make a decision on how to fix/modernise it then I'll trust that.
Regarding https://github.com/frou/yt2pod/issues/42#issuecomment-1134778535 - Sorry about that, I will make that more robust. In addition, I think an alternative to being forced to use -buildvcs=false
is that the .git
directory could be added to the Docker image such that it is present at build time.
Besides that, I suspect that the approach taken by the Dockerfile has become outdated since this project transitioned from a traditional GOPATH
-oriented project to a Go Module project.
The part where it creates the deeply nested directory structure (/go/src/github.com/frou/yt2pod/
) that mimics the project's Import Path, and then runs go get -d ./... && go install
looks suspicious. In a Go Module world, I think those parts should instead be replaced with approximately this:
RUN mkdir /build_dir
ADD . /build_dir
ADD ./.git /build_dir/.git
WORKDIR /build_dir
RUN go build
# copy ./yt2pod executable to somewhere
introspectOwnVersion
function fixed in https://github.com/frou/yt2pod/commit/13702ab86b6acddfa96a52ef86ba75f2fa79395e
RUN mkdir /build_dir ADD . /build_dir ADD ./.git /build_dir/.git WORKDIR /build_dir RUN go build # copy ./yt2pod executable to somewhere
This seems to work very well, thanks.
Cool - and the version shows as non-unknown
in the log? If so, we can probably merge this?
Ha, I forgot to check that. Turns out git does need to be installed during build.
Thanks for doing this.
BTW I'm always curious about how yt2pod users are handling the requirement to have a YouTube Data API key. Do you have your own key that you originally got from Google for another purpose? Or did you get one from Google to be able to use this? I know a bunch of people previously used a "shared" key that I placed in the example config file, but IIRC that got deactivated a while ago.
I did get a YouTube key directly from Google some time ago. So far, it’s been working.
I had the following errors when building the previous docker image:
and