Closed tadly closed 8 months ago
Thanks. I'm not very experienced with Docker but I'll see what I can do. What command do I need to run to make this happen please, just to get me started?
Sounds like you don't have this build issue on your side then? That's kinda weird.
Instead of npm install https://github.com/mas94uk/upnpTube
I've now manually git clone
'ed the repo and did it that way.
This has worked.
You probably also want to use npm ci instead of npm install https://betterprogramming.pub/npm-ci-vs-npm-install-which-should-you-use-in-your-node-js-projects-51e07cb71e26
Good lord. Why would I ever want to use npm install then? ':D What a mess.
Anyways. This is a working Dockerfile
for anyone interested.
It might not be the prettiest but for giving the project a whirl it's good enough
FROM alpine:3.17
RUN apk add --no-cache \
git \
npm \
yt-dlp
RUN git clone https://github.com/mas94uk/upnpTube /tmp/upnpTube \
&& cd /tmp/upnpTube \
&& npm ci \
&& npm link
ENTRYPOINT [ "node", "/usr/local/bin/upnpTube" ]
And here's a docker-compose.yaml
example:
version: '3'
services:
upnpTube:
container_name: upnp-tube
image: mas94uk/upnp-tube
network_mode: 'host'
build:
context: './upnpTube' # folder containing the Dockerfile
volumes:
- '/etc/localtime:/etc/localtime:ro' # I prefer doing it that way, don't judge
restart: unless-stopped
Sounds like you don't have this build issue on your side then? That's kinda weird.
I don't know whether I do or not - I haven't had time to try it yet. Was asking what to do to make it happen since I'm not very familiar with creating Docker images.
Instead of
npm install https://github.com/mas94uk/upnpTube
I've now manuallygit clone
'ed the repo and did it that way. This has worked.
is this a good solution or should it work the other way?
I don't know whether I do or not - I haven't had time to try it yet. Was asking what to do to make it happen since I'm not very familiar with creating Docker images.
What I meant is. You build your project locally for testing and that seems to work fine.
I now suspect that if you do a npm install https://github.com/mas94uk/upnpTube
and npm link
on your system (without docker), you will get the same error.
I have never worked with npm or node (am a python guy) but if npm install <git repo url>
is a supported feature (which it is) then that should work just like cloning the repository manually and doing it that way.
What I haven't tried is npm ci <git repo url>
. Maybe that works better? No idea :)
I'll work through all this when I get a bit of free time, try and get it all resolved. Thanks for the input @tadly and @dgalli1 !
Finally got a bit of time to think about this. It seems the original problem is an npm bug (I found the issue and now can't find it again) but anyways the workaround seems OK for now.
I've added basically your Dockerfile and docker-compose.yaml, run it up on a couple of machines and it seems to work. I don't suppose @tadly you'd be kind enough to look at the instructions I've added to the README and tell me if it's sensible? Is there a better way to do it? I'm really not very familiar with Docker so I'm not sure what I've written makes sense.
Thanks!
It's all gone quiet. The workaround seems an OK way of doing it, so closing.
Following the instructions I've created a Dockerfile for testing this project
I also created a ubuntu version to make sure this isn't a alpine issue:
Sadly the build fails with the following error:
I've never done anything with npm or js so I'm not sure what to do here.