Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Container Images for ARM Architecture (RaspberryPi) #108

Closed
rondadon opened this issue Nov 4, 2019 · 16 comments
Closed

Docker Container Images for ARM Architecture (RaspberryPi) #108

rondadon opened this issue Nov 4, 2019 · 16 comments
Milestone

Comments

@rondadon
Copy link

rondadon commented Nov 4, 2019

Is your feature request related to a problem? Please describe.
As I am setting up the RaspberryPi 4 as a 24/7 Server which will run some services I wanted to have a picture gallery accessible over a WebUI. So I researched which galleries would be suitable for a RaspberryPi and all my findings led me to try out pigallery.

As I want to use docker images for as many services as I could I also wanted to try pigallery on the Raspberry pi with a docker image. I was really sure, because of the name, that the provided docker images would also run on ARM architecture like on the RaspberryPi. I first tried to run it but always got stuck and then it struck me. All Docker Images are build for the AMD64 architecture and not for the ARM architecture.

It would be really nice if there would be also a ARM Docker image of Pigallery available to use on the Raspberry Pi 4. Would be really helpful.

Thank you very much in advance. :)
Have a nice day!

@yip623
Copy link

yip623 commented Nov 20, 2019

Same case.
Appreciate if there is ARM docker image

@bpatrik
Copy link
Owner

bpatrik commented Nov 21, 2019

Hi,

When I last researched, It is not possible to build ARM based docker images at docker hub.
(There might be a way to upload an image there If I would have a dedicated build server that pushes the built image to the hub)
So I stuck with the ARM image.

There should be a way of building the image by hand, but I did not have the time to look into it yet.

best,
Patrik

@bpatrik bpatrik added this to the v1.8 milestone Dec 15, 2019
@Suika
Copy link
Contributor

Suika commented Dec 16, 2019

@bpatrik Looked further into this and started working with github actions. It should be possible to build different architecture images with buildx in exepremental mode. https://github.com/crazy-max/ghaction-docker-buildx

I'm currently testing it, but there seem to have some problems. Not to mention 1h+ build times https://github.com/Suika/pigallery2/blob/master/.github/workflows/build.yml https://github.com/Suika/pigallery2/blob/master/docker/alpine/Dockerfile

Should it somehow work, it will show up under suika/pig2:latest if not... more debugging.

@bpatrik
Copy link
Owner

bpatrik commented Dec 16, 2019

@Suika It looks good.
In the meantime i was able to build to arm on docker hub like this https://github.com/bpatrik/pigallery2/blob/master/docker/arm32v6/alpine/Dockerfile with hooks.
But the build was also slow, especially if I only used one builder like here: https://github.com/bpatrik/pigallery2/blob/27a88c98eb981b4bc33d363000687c579e6c7849/docker/arm32v6/alpine/Dockerfile
It run more than 240min when docker hub terminated the build.

My current understanding on the topic:

docker buildx helps you achieving multiarch build.
Unfortunately. it is not supported on docker hub yet, but there is an open issue about it: docker/hub-feedback#1874

Alternatively it is possible to use docker manifest method to get to the same result: https://github.com/rmoriz/multiarch-test

+1

As an extra feature it would be great to have a common release builder image, or achieve the same with github action, like this:

FROM node:12-alpine AS node-builder
RUN apk add python build-base
# copying only package{-lock}.json to make node_modules cachable
COPY package*.json /build/
WORKDIR /build
RUN set -x && npm install --unsafe-perm
# build app
COPY . /build
RUN npm run create-release

Building the release folder takes a lot of time (especially on arm) and it is the same for all archs.

@Suika
Copy link
Contributor

Suika commented Dec 16, 2019

That's good to know because I would've asked it otherwise. About the create-release being OS/Arch independent.

Will invest some time into it the next few days, but there seem to be problems with node-sqlite3 and arm. Can be due to musl, if it can't be done with alpine, will swing over to some other OS.

@bpatrik
Copy link
Owner

bpatrik commented Dec 17, 2019

You can find and example for the npm run create-release output at the relesaes. It only contains .js (and .html .md, etc..) files, no binary.

It seems that I was able to build the app on arm32v6 and arm32v7/node:12-alpine . (Haven't run/test them yet tho, but the build process finishes)

I was also able to reduce the amd64 stretch image size to 130MB with stretch-slim (compared to 100Mb amd64 alpine).

My personal experience earlier that writing ububtu-based host filesystem from alpine-based docker container has issues. Docker broke from time to time. After changing to ubuntu based image, the issue was gone. So I'd like to support stretch also as a base.

@Suika
Copy link
Contributor

Suika commented Dec 17, 2019

Ok, it seems to have built, check https://hub.docker.com/r/suika/pigallery2/tags
This workflow should do the trick https://github.com/Suika/pigallery2/blob/master/.github/workflows/build.yml and this Dockerfile https://github.com/Suika/pigallery2/blob/master/docker/alpine/Dockerfile.build

Takes ~1h20m to build.

grafik

@Suika
Copy link
Contributor

Suika commented Dec 17, 2019

Ok, works on x86_64 systems, someone needs to test it on arm devices. The config volume needs to be deleted.
Gonna check if it builds against armv7

@bpatrik
Copy link
Owner

bpatrik commented Dec 17, 2019

Thanks! Look good.
I did a quick test. I run the following on a RPI3:
docker run suika/pigallery2:latest (downloaded container id: 6a7892b00eeb89675524f4)
docker run bpatrik/pigallery2:arm32v6-nightly-alpine
docker run bpatrik/pigallery2:arm32v7-nightly-alpine

They run, but all of them had the same issue:
sharp and ffmpeg/ffprobe could not be found. (both could be installed as node modules)
ffmpeg can be solved with a 'apt-get install', but sharp need to be build from source. Running npm install on the host directly (raspbian) installs sharp, so it should work on arm too. (can't remember about ffmpeg)

I'll also look into it later, but unfortunately, no time before weekend.

@Suika
Copy link
Contributor

Suika commented Dec 17, 2019

https://github.com/Suika/pigallery2/runs/351818224

2019-12-17T02:50:59.8157607Z #50 131.5 npm notice created a lockfile as package-lock.json. You should commit this file.
2019-12-17T02:50:59.8158300Z #50 131.5 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/linux-arm@4.1.3 (node_modules/@ffmpeg-installer/linux-arm):
2019-12-17T02:50:59.8158963Z #50 131.5 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/linux-arm@4.1.3: wanted {"os":"linux","arch":"arm"} (current: {"os":"linux","arch":"x64"})
2019-12-17T02:50:59.8159380Z #50 131.5 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/darwin-x64@4.1.0 (node_modules/@ffmpeg-installer/darwin-x64):
2019-12-17T02:50:59.8159841Z #50 131.5 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/darwin-x64@4.1.0: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2019-12-17T02:50:59.8160272Z #50 131.5 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/linux-arm64@4.1.4 (node_modules/@ffmpeg-installer/linux-arm64):
2019-12-17T02:50:59.8160727Z #50 131.5 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/linux-arm64@4.1.4: wanted {"os":"linux","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2019-12-17T02:50:59.8161143Z #50 131.5 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/linux-ia32@4.1.0 (node_modules/@ffmpeg-installer/linux-ia32):
2019-12-17T02:50:59.8161594Z #50 131.5 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/linux-ia32@4.1.0: wanted {"os":"linux","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2019-12-17T02:50:59.8162002Z #50 131.5 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffprobe-installer/linux-ia32@4.1.0 (node_modules/@ffprobe-installer/linux-ia32):
2019-12-17T02:50:59.8162462Z #50 131.5 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffprobe-installer/linux-ia32@4.1.0: wanted {"os":"linux","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2019-12-17T02:50:59.8163047Z #50 131.5 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/win32-x64@4.1.0 (node_modules/@ffmpeg-installer/win32-x64):
2019-12-17T02:50:59.8163517Z #50 131.5 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/win32-x64@4.1.0: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2019-12-17T02:50:59.8163932Z #50 131.5 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffprobe-installer/darwin-x64@4.1.0 (node_modules/@ffprobe-installer/darwin-x64):
2019-12-17T02:50:59.8164402Z #50 131.5 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffprobe-installer/darwin-x64@4.1.0: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2019-12-17T02:50:59.8165307Z #50 131.5 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffprobe-installer/win32-ia32@4.1.0 (node_modules/@ffprobe-installer/win32-ia32):
2019-12-17T02:50:59.8165827Z #50 131.5 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffprobe-installer/win32-ia32@4.1.0: wanted {"os":"win32","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2019-12-17T02:50:59.8166457Z #50 131.5 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffprobe-installer/win32-x64@4.1.0 (node_modules/@ffprobe-installer/win32-x64):
2019-12-17T02:50:59.8167007Z #50 131.5 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffprobe-installer/win32-x64@4.1.0: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2019-12-17T02:50:59.8167441Z #50 131.5 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @ffmpeg-installer/win32-ia32@4.1.0 (node_modules/@ffmpeg-installer/win32-ia32):
2019-12-17T02:50:59.8167920Z #50 131.5 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @ffmpeg-installer/win32-ia32@4.1.0: wanted {"os":"win32","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2019-12-17T02:50:59.8168196Z #50 131.5 
2019-12-17T02:50:59.8168338Z #50 131.5 added 414 packages from 723 contributors and audited 1180 packages in 129.743s
2019-12-17T02:50:59.8168799Z #50 131.5 found 0 vulnerabilities
2019-12-17T02:50:59.8168921Z #50 131.5 
2019-12-17T02:51:00.4162150Z #50 ...

¯\_(ツ)_/¯ ffmpeg is installed as system package, alpine seems to need vips-dev

https://sharp.pixelplumbing.com/en/stable/install/#alpine-linux

@bpatrik
Copy link
Owner

bpatrik commented Dec 18, 2019

hm.
pigallery works with both if ffmpeg (and ffprobe) are available in the PATH or installed as npm packages. I'm not sure what is the issue then.

Also I don't mind if we only support debian. With stretch-slim it has almost the same image size (30MB difference, see here).
arm32v6 can be also dropped (arm32v6/node only has alpine versions) as from raspberry pi 2 (from 2015) runs on v7 or better: https://en.wikipedia.org/wiki/Raspberry_Pi
On the other hand, I'd like to support arm32v7 and arm64v8.

@Suika
Copy link
Contributor

Suika commented Dec 18, 2019

Up to you from now on. I'll leave the copy be as is.
You just need to adjust the Docker.build to use ubuntu (debian is outdated in many cases) and install the proper packages.

The workflow is there and you need only adjust the archs to be built against and the secrets.

@bpatrik
Copy link
Owner

bpatrik commented Dec 18, 2019

perfect. Would you like to make a PR so it shows up at the contributions? Otherwise I can handle from here.

@Suika
Copy link
Contributor

Suika commented Dec 19, 2019

Just copy it. You will have to change a few things either way.

@bpatrik
Copy link
Owner

bpatrik commented Dec 23, 2019

Pigallery2 now supports arm ( bpatrik/pigallery2:nightly-stretch tested on Raspberry PI 3).
Currently only with nightly build.
Read more at https://github.com/bpatrik/pigallery2/tree/master/docker

@bpatrik bpatrik closed this as completed Dec 23, 2019
@rondadon
Copy link
Author

Thank you very much for this. Will test it! Have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants