Closed wychwitch closed 5 years ago
I now suspect that this is due to a wonky npm installation. I tried the installation method outside of the dockerfile and I got an error, and installing via adding the nodejs repo to my package manager (apt-get) game be an illegal instruction (nodejs -v). Npm simply can't be found.
I'm going to try and install a few different ways. Once I have it verified and working correctly I'll punch those same commands into my socket file and rebuild the image
This entire project is split into two parts. client/
is just a web interface that runs in the user's web browser, written in your usual HTML/JS/CSS. node/npm is only used for the build.js
script that bundles all the client-side Javascript and CSS together. It's not used during runtime.
server/
is a REST API written in Python that is the core of the application. It doesn't need node to run. It's only dependencies are ffmpeg
, the python packages in requirements.txt
, and a connection to a PostgreSQL database plus an ElasticSearch database. You don't need to install node here.
So there's no need to modify server/Dockerfile
to include node. Your error seems to be originating from the first build stage of client/Dockerfile
. Here, you may need to change FROM node:9
to a base image compatible with ARM architecture.
And for server/Dockerfile
, if you can find a way to get ARM-compatable wheel (binary) distributions for all the Python packages, you wouldn't need to install gcc and all the build tools. I'm not familiar with running Python on ARM systems, so I'm not sure how easy this is.
Hope this helps!
oh wow, I had no idea there was even a client dockerfile! I should've looked there whoops.
Thank you so much! While searching I found this https://hub.docker.com/r/hypriot/rpi-node/ which looks like it's exactly what I need. I just have to replace FROM node:9
to FROM hypriot/rpi-node:9
right? This whole experience has been my first time messing around with docker so forgive me if this is an obvious question.
EDIT: I ran it and it seems to have worked! its on step 8/16 of building the client so I'm going to let it finish running before I close this issue. Thank you so much @sgsunder !
Yep it worked! I'm having another error (szuru_elasticsearch_1 exited with code 1
) but I'm pretty sure it's unrelated and probably my fault.
To Summarize for anyone who's running into this exact same problem, here is my client/Dockerfile:
FROM hypriot/rpi-node:8 as builder
WORKDIR /opt/app
COPY package.json ./
RUN npm install
COPY . ./
ARG BUILD_INFO="docker-latest"
ARG CLIENT_BUILD_ARGS=""
RUN BASE_URL="__BASEURL__" node build.js ${CLIENT_BUILD_ARGS}
RUN find public/ -name public/index.html -prune -o -type f -size +5k \
-print0 | xargs -0 -- gzip -6 -k
FROM nginx:alpine
WORKDIR /var/www
RUN \
# Create init file
echo "#!/bin/sh" >> /init && \
echo 'sed -i "s|__BACKEND__|${BACKEND_HOST}|" /etc/nginx/nginx.conf' \
>> /init && \
echo 'sed -i "s|__BASEURL__|${BASE_URL:-/}|" /var/www/index.htm' >> /init &&
\
echo 'exec nginx -g "daemon off;"' >> /init && \
chmod a+x /init
CMD ["/init"]
VOLUME ["/data"]
COPY nginx.conf.docker /etc/nginx/nginx.conf
COPY --from=builder /opt/app/public/ .
Like was said earlier, change the FROM node:9 as builder
to FROM hypriot/rpi-node:8 as builder
. 8 because as far as I can tell, rpi-node:9 doesn't exist.
Thanks again @sgsunder for the help! I couldn't have done it without you. If I can't fix my new error I'll open up a separate issue for it. Edit: a issue was already opened for this problem! Here is my comment on it. if anyone is going down this same rabbithole as me in the future.
Hello, I'm currently running into this problem when building the front end on my raspberry pi 1.
Here is my docker file
My os information is as follows:
As you can see I've editedthis socket file a bit. I ran into some dependency problems (mostly pillow, but also make before that) I fixed by including them in an apt-get. I also wget'd nodejs to make sure I had it installed in case that was the cause of the issue. Please let me know if there's anything I can fix or if you'd like more logs, I'm out of ideas.
Also because this is on a raspberry pi, numpy takes nearly 3 hours to compile so it might take a little while to try out a fix.
Thanks in advance to anyone who might help!