viewtube icon indicating copy to clipboard operation
viewtube copied to clipboard

Docker - ARM image unavailable/not working.

Open xcellardoor opened this issue 3 years ago • 10 comments

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).

xcellardoor avatar Jul 25 '22 09:07 xcellardoor

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"]

beardeddude avatar Jul 25 '22 20:07 beardeddude

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. (/home/app/.yarn/cache/redis-npm-3.1.2-0dbc9973a0-baec421986.zip/node_modules/redis/index.js:223:14) at Socket.emit (node:events:527:28) at Socket.emit (node:domain:475:12) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 6379 }

WARN Worker 79 died with code 1. Restarting worker.

xcellardoor avatar Jul 26 '22 10:07 xcellardoor

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)

beardeddude avatar Jul 26 '22 19:07 beardeddude

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?

root9191 avatar Jul 27 '22 10:07 root9191

Clone the repo, replace the Dockerfile with mine, run "docker-compose up -d" from the repo dir, verify all 3 containers are working correctly

beardeddude avatar Jul 27 '22 15:07 beardeddude

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

root9191 avatar Jul 27 '22 16:07 root9191

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: @.***>

xcellardoor avatar Jul 27 '22 17:07 xcellardoor

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

beardeddude avatar Jul 27 '22 19:07 beardeddude

OK i got it now :) I took the original Dockerfile and changed the Lines as you and now it works 👍 Thanks a lot!

root9191 avatar Jul 27 '22 19:07 root9191

NP. Put it in an PR for you guys https://github.com/ViewTube/viewtube-vue/pull/1472

beardeddude avatar Jul 27 '22 19:07 beardeddude

I would still love an arm image published to the repo for ease of keeping things up to date.

InvisibleFunction avatar Mar 19 '23 19:03 InvisibleFunction

Arm and arm64 images are now available under the nightly tag. https://github.com/ViewTube/viewtube/issues/1321#issuecomment-1476947427

moisout avatar Mar 20 '23 21:03 moisout