Closed abrodkin closed 1 year ago
I don't have ARM, but if someone wants to get this done, I'm happy to accept PR.
Depends on phusion/baseimage-docker#484 if we want functionality parity with the current image.
I see no particular reason to be strongly committed on any particular base. Likely it would be prudent to use modern Debian or Ubuntu base, so that we have simpler time with the SSH requirement.
Some current documented and supported features (syslog, cron jobs, ...) rely on phusion/baseimage-docker, and can't be easily ported without re-doing all the work that's being done there.
The libssh backport stage will be obsolete once phusion/baseimage-docker makes the jump to Ubuntu Bionic (18.04) which should happen in phusion/baseimage-docker#479 once the .01 release of Bionic is out (July 26th per this.
Even though there's no need to hurry here and we may safely wait for Ubuntu 18.04.01 but just for my understanding - are there any other changes in existing Dockerfile required for non-amd64 platfrom other than copying of previously built libssh in "# upgrade libssh2 to self-built backport from stage 1"?
If so probably it's possible to replace arch suffix in .deb names with *, right?
@abrodkin to summarize and clarify:
@wk Thanks a lot for your explanation, that makes a lot of sense! So indeed once both issues in Phusion are solved Oxidized docker could be built for both ARM arches (v7 and v8) with almost no extra efforts (other than setting-up DockerHub automated build for multiple arches).
This appears to have just been unblocked upstream by phusion/baseimage-docker#534 - once a new release is available, we could attempt integration on our end to support all of amd64/arm64/arm32 in the Oxidized
docker container.
Building on another platform appears to work:
$ docker buildx build --platform linux/arm64 https://github.com/ytti/oxidized.git
[+] Building 3828.7s (19/19) FINISHED
=> CACHED [internal] load git source https://github.com/ytti/oxidized.git 0.0s
=> [internal] load metadata for docker.io/phusion/baseimage:jammy-1.0.1 2.1s
=> => resolve docker.io/phusion/baseimage:jammy-1.0.1@sha256:7faf4efcd96870fe090d969703ef8e727cc9de4f465c8442047 0.0s
=> => sha256:a3ebc75903129e065f7ac874f54358bce0222e8fe835f46a71d59373bee73c7c 1.99kB / 1.99kB 0.0s
=> => sha256:00f50047d6061c27e70588a5aab89adada756e87d782a6c6bd08b4139eb8ea10 28.38MB / 28.38MB 15.4s
=> => sha256:5c55cf94b04f6810558eb007f797949dd8cea2f4cb27e3d4d839842913b94435 15.21kB / 15.21kB 0.3s
=> => sha256:fe7148aca4bde5a5ec09c8d4c5cc01332c76dc6f94f0149c551613eea34c8795 53.28MB / 53.28MB 24.4s
=> => sha256:7faf4efcd96870fe090d969703ef8e727cc9de4f465c8442047ffd26f8094e6b 1.39kB / 1.39kB 0.0s
=> => sha256:0ed18d6d6fbdb6e4e6bd9e4d657af1d9b421dfb3a31fae52eeced122374b7f9c 950B / 950B 0.0s
=> => extracting sha256:5c55cf94b04f6810558eb007f797949dd8cea2f4cb27e3d4d839842913b94435 0.0s
=> => extracting sha256:fe7148aca4bde5a5ec09c8d4c5cc01332c76dc6f94f0149c551613eea34c8795 2.3s
=> [ 3/17] RUN gem install --no-document aws-sdk slack-ruby-client xmpp4r cisco_spark 1138.4s
=> [ 4/17] RUN gem install --no-document gpgme sequel sqlite3 mysql2 pg 1055.5s
=> [ 5/17] RUN gem install --no-document net-tftp net-http-persistent mechanize 49.5s
=> [ 6/17] COPY . /tmp/oxidized/ 0.2s
=> [ 8/17] RUN git fetch --unshallow || true 0.7s
=> [ 9/17] RUN CMAKE_FLAGS='-DUSE_SSH=ON' rake install 1167.9s
=> [10/17] RUN gem install oxidized-web --no-document 230.0s
=> [11/17] RUN rm -rf /tmp/oxidized 0.7s
=> [12/17] RUN apt-get -yq --purge autoremove ruby-dev pkg-config make cmake ruby-bundler libssl-dev libssh2-1- 10.1s
=> [13/17] RUN groupadd -g "30000" -r oxidized && useradd -u "30000" -r -m -d /home/oxidized -g oxidized oxidize 1.1s
=> [14/17] COPY extra/oxidized.runit /etc/service/oxidized/run 0.1s
=> [15/17] COPY extra/auto-reload-config.runit /etc/service/auto-reload-config/run 0.1s
=> [16/17] COPY extra/update-ca-certificates.runit /etc/service/update-ca-certificates/run 0.1s
=> exporting to image 4.2s
=> => exporting layers 4.1s
=> => writing image sha256:b9cfac9d270af3fbc0b974eaf418c7f3cb644c6684d4f5a1130519d29ec13f65 0.0s
however copying that image to an arm64 host results in:
$ docker compose up
[+] Running 2/2
✔ Network oxidized_default Created 0.2s
✔ Container oxidized-oxidized-1 Created 0.1s
Attaching to oxidized-oxidized-1
oxidized-oxidized-1 | *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
oxidized-oxidized-1 | *** Running /etc/my_init.d/10_syslog-ng.init...
oxidized-oxidized-1 | May 7 20:25:46 1d606405704b syslog-ng[14]: syslog-ng starting up; version='3.35.1'
oxidized-oxidized-1 | *** Booting runit daemon...
oxidized-oxidized-1 | *** Runit started as PID 23
oxidized-oxidized-1 | May 7 20:25:47 1d606405704b cron[34]: (CRON) INFO (pidfile fd = 3)
oxidized-oxidized-1 | May 7 20:25:47 1d606405704b cron[34]: (CRON) INFO (Running @reboot jobs)
oxidized-oxidized-1 | /var/lib/gems/3.0.0/gems/oxidized-0.29.1/bin/oxidized:7:in `require_relative': cannot load such file -- /var/lib/gems/3.0.0/gems/oxidized-0.29.1/lib/oxidized/cli (LoadError)
oxidized-oxidized-1 | from /var/lib/gems/3.0.0/gems/oxidized-0.29.1/bin/oxidized:7:in `<top (required)>'
oxidized-oxidized-1 | from /usr/local/bin/oxidized:25:in `load'
oxidized-oxidized-1 | from /usr/local/bin/oxidized:25:in `<main>'
oxidized-oxidized-1 | /var/lib/gems/3.0.0/gems/oxidized-0.29.1/bin/oxidized:7:in `require_relative': cannot load such file -- /var/lib/gems/3.0.0/gems/oxidized-0.29.1/lib/oxidized/cli (LoadError)
oxidized-oxidized-1 | from /var/lib/gems/3.0.0/gems/oxidized-0.29.1/bin/oxidized:7:in `<top (required)>'
oxidized-oxidized-1 | from /usr/local/bin/oxidized:25:in `load'
oxidized-oxidized-1 | from /usr/local/bin/oxidized:25:in `<main>'
oxidized-oxidized-1 | /var/lib/gems/3.0.0/gems/oxidized-0.29.1/bin/oxidized:7:in `require_relative': cannot load such file -- /var/lib/gems/3.0.0/gems/oxidized-0.29.1/lib/oxidized/cli (LoadError)
oxidized-oxidized-1 | from /var/lib/gems/3.0.0/gems/oxidized-0.29.1/bin/oxidized:7:in `<top (required)>'
oxidized-oxidized-1 | from /usr/local/bin/oxidized:25:in `load'
oxidized-oxidized-1 | from /usr/local/bin/oxidized:25:in `<main>'
^CGracefully stopping... (press Ctrl+C again to force)
Aborting on container exit...
and the whole lib directory seems to be missing:
$ docker compose run -it oxidized bash
root@ab4b6199e992:/# cd /var/lib/gems/3.0.0
root@00c651303d1c:/var/lib/gems/3.0.0# cd gems/oxidized-
oxidized-0.29.1/ oxidized-web-0.13.1/
root@00c651303d1c:/var/lib/gems/3.0.0# cd gems/oxidized-0.29.1/
root@00c651303d1c:/var/lib/gems/3.0.0/gems/oxidized-0.29.1# ls
bin
root@00c651303d1c:/var/lib/gems/3.0.0/gems/oxidized-0.29.1# find / -name cli
/usr/lib/ruby/3.0.0/bundler/cli
/var/lib/gems/3.0.0/gems/rugged-1.6.3/vendor/libgit2/src/cli
root@00c651303d1c:/var/lib/gems/3.0.0/gems/oxidized-0.29.1#
Looks like Docker Hub now supports multiarch so would be quite cool to have an image for boards like Raspberry Pi etc. I guess having an image for ARMv7 (and maybe even ARMv8 if v7 gets done easily) would be very welcome addition since Oxidized doesn't require a lot of resources from target platform.