Docker - ARM image unavailable/not working.
Describe the Bug
The ARM variant of the image under the 'dev' tag on Docker seems to be unavailable.
Steps to Reproduce the Bug
Attempt to use the image tagged mauriceo/viewtube:dev to run ViewTube on a Raspberry Pi.
The result is the classic: standard_init_linux.go:219: exec user process caused: exec format error
Expected Behaviour
The image to load successfully and begin serving itself on 8066.
Screenshot/Screen recording
Device Info
Raspberry Pi 4 - 32bit OS variant (akin to ARMHF).
I had this issue when setting up viewtube myself. There is a workaround. Although first I would highly recommend you upgrade to a 64-bit os (the raspi 4 supports it and there is a 64 bit rasbian).
The issue is that a dependency (libvips if I remember correctly) does not have a prebuilt binary for ARMHF with the musl compiler (the one used by alpine linux). You can get this to work for yourself by modifying the docker file to use a node image based on debian. That way u will be using the gclib C system. There is a bit in the docker file where the build is copied to a new image but i just used the node image I built on. Make sure to swap out the lines that install new software so that they call apt instead.
FROM node:16-buster as build WORKDIR /home/build
ENV BUILD_ENV=production
COPY prepare.js package.json ./ COPY .yarn ./.yarn/ COPY yarn.lock .yarnrc.yml ./
COPY server/package.json ./server/ COPY client/package.json ./client/ COPY shared/package.json ./shared/
RUN yarn install
COPY . .
RUN yarn build
RUN yarn cache clean &&
yarn workspaces focus --all --production &&
yarn cache clean --mirror
FROM node:16-buster as runtime WORKDIR /home/app
#RUN apt update && apt install -y nodejs
COPY --from=build /home/build/.yarn/ ./.yarn/ COPY --from=build /home/build/.pnp.cjs /home/build/package.json /home/build/yarn.lock /home/build/.yarnrc.yml ./
COPY --from=build /home/build/server/package.json ./server/ COPY --from=build /home/build/server/dist ./server/dist/
COPY --from=build /home/build/client/package.json /home/build/client/nuxt.config.ts ./client/ COPY --from=build /home/build/client/dist ./client/dist/ COPY --from=build /home/build/client/static ./client/static/
ENV VIEWTUBE_BASE_DIR=/home/app ENV NODE_ENV=production HEALTHCHECK --interval=30s --timeout=20s --start-period=60s CMD wget --no-verbose --tries=3 --spider http://localhost:8066/ || exit 1 EXPOSE 8066
CMD ["node", "-r", "/home/app/.pnp.cjs", "/home/app/server/dist/main.cjs"]
Thanks for the reply. I built the Docker image based on your amended Dockerfile, and it boots up but then has the following issue. P.S. I keep meaning to upgrade to the 64bit variant of Raspbian but my servers were built when 32bit was mainline and I haven't found the energy to swap them over just yet!
node:events:505 throw er; // Unhandled 'error' event ^
Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
Emitted 'error' event on RedisClient instance at:
at RedisClient.on_error (/home/app/.yarn/cache/redis-npm-3.1.2-0dbc9973a0-baec421986.zip/node_modules/redis/index.js:342:14)
at Socket.
WARN Worker 79 died with code 1. Restarting worker.
You probably have something misconfigured. I suggest running the image using the docker-compose setup in the repo. Make sure that redis and mongo are both up and running (mongo is not a fan of 32-bit ARM so u may need to swap out that image)
I will give this a try later too. Do i need to clone the Repo too or do i just need your Dockerfile for building this up?
Clone the repo, replace the Dockerfile with mine, run "docker-compose up -d" from the repo dir, verify all 3 containers are working correctly
I did like you said, but the YARN Command is unknown:
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 21: unknown instruction: YARN
I had the same problem, it's just the way the Dockerfile was pasted to GitHub. Notice the && symbols? Those three lines should all be one long line.
On 27 July 2022 17:33:18 BST, root9191 @.***> wrote:
I did like you said, but the YARN Command is unknown:
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 21: unknown instruction: YARN-- Reply to this email directly or view it on GitHub: https://github.com/ViewTube/viewtube-vue/issues/1470#issuecomment-1196985767 You are receiving this because you authored the thread.
Message ID: @.***>
ya, just a lazy copy/paste on my part (lazy change as well. I could have cleaned up and made a MR). Really just a couple lines diff from the original dockerfile. Best to make the changes by hand because copy paste tends to mess things up.
All I did was change the 2 FROM lines and comment out one RUN line
OK i got it now :) I took the original Dockerfile and changed the Lines as you and now it works 👍 Thanks a lot!
NP. Put it in an PR for you guys https://github.com/ViewTube/viewtube-vue/pull/1472
I would still love an arm image published to the repo for ease of keeping things up to date.
Arm and arm64 images are now available under the nightly tag. https://github.com/ViewTube/viewtube/issues/1321#issuecomment-1476947427