Skip to content

Use multi-arch node base image #105

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

Merged

Conversation

RandomByte
Copy link
Contributor

As discussed in #102, change the main Dockerfile to use the muli-arch capable node:8-alpine image as base. This adds support for multiple architectures including ARM and makes some of the arch-specific Dockerfiles obsolete.

I tested this on a MacBook and Rasperry Pi 3 (ARMv8) without issues. I therefore went ahead and removed the Dockerfile.arm file and corresponding readme documentation.
If someone could confirm that the Dockerfile.aarch64 file is obsolete as well, we can remove it too.

I guess the Windows variant is still needed and could only be removed by adding build args to the main Dockerfile as @StefanScherer mentioned?

Btw. image size on Raspberry Pi is now down to 153MB (compared to 416MB with the old Dockerfile.arm)

README.md Outdated
@@ -45,26 +45,8 @@ $ docker service create \
dockersamples/visualizer
```

## Running on ARM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not remove this section. Someone will still have to build and maintain an image on the Docker Hub.

Copy link
Contributor

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't automatically make the image work on any architecture - it'll only work on the platform it's built on unless lots of additional work is done to make this an official library image where CI is done for each platform and pushed under a multi-stage image.

I'd recommend not merging this PR.

README.md Outdated

[View on Docker Hub](https://hub.docker.com/r/alexellis2/visualizer-arm/tags/)
## Supported architectures
The main image is based on [node:8-alpine](https://hub.docker.com/_/node/). With that it already offers support for many architectures, including ARM (so it can run on your Raspberry Pi). See below for instructions on how to run on Windows.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This chapter should be more clear how to build the image for another architecture.
I assume there will be still only the linux/amd64 image as dockersamples/visualizer image.

So we need at least the docker build step how to build it locally and then use the commands above to start the visualizer.

@RandomByte RandomByte force-pushed the use-multi-arch-node-base-image branch from 5df2f52 to f180e56 Compare February 11, 2018 19:33
@RandomByte
Copy link
Contributor Author

I see, sorry for the misunderstanding. I updated the readme to make it clearer what to do for any given architecture and especially how to build. Please let me know what you think.

Copy link
Contributor

@StefanScherer StefanScherer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the good overview of all Linux architectures.

README.md Outdated
@@ -61,7 +71,7 @@ $ docker service create \
If you would like to build the image from source run the following command:

```
$ docker build -f Dockerfile.arm -t visualizer-arm:latest .
$ docker build -f Dockerfile -t visualizer-arm:latest .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can omit -f Dockerfile here.

README.md Outdated

To build an up-to-date image for any architecture supported by [node:8-alpine](https://hub.docker.com/_/node/) (currently `amd64`, `arm32v6`, `arm32v7`, `arm64v8`, `i386`, `ppc64le` and `s390x`), execute the following command on a device of your target architecture:
```
$ docker build -f Dockerfile -t visualizer-custom:latest .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can omit -f Dockerfile here.

README.md Outdated

The main `dockersamples/visualizer` image supports **linux/amd64**.

**For ARM**, there is a pre-built image available. See [Running on ARM](#running-on-arm).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be more specific about "arm" - this works for armhf only, it won't work for 64-bit ARM such as that found on Packet's or Scaleway's servers or the Pine64 etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Done 👍

@RandomByte
Copy link
Contributor Author

Any further objections @alexellis, @StefanScherer?

@StefanScherer
Copy link
Contributor

Seems good to me.

@RandomByte
Copy link
Contributor Author

RandomByte commented Jun 11, 2018

@alexellis any update from your side?

@StefanScherer
Copy link
Contributor

@RandomByte I have some time to test your PR. Can you remove the Dockerfile.aarch64 as well? It is obsolete with your PR as well.

Someone on a RPi Zero/1 can build it, someone else can use the same Dockerfile on RPi3 64bit or on another ARM64 board and build it.

@StefanScherer
Copy link
Contributor

The build works as well as the visualizer on

  • Docker Desktop on macOS to build a linux/amd64 image
  • Raspberry Pi 3 with Raspbian or HypriotOS 32bit to build the linux/armv6 image
  • Raspberry Pi 1 (yes, the old one with 1/2 GByte RAM, I just found a compatible 4 GByte SD card) to slowly 😴 build linux/armv6 image
  • Raspberry Pi 3 with HypriotOS 64bit to build the linux/arm64 image

One Dockerfile to rule them all. 🎉

As mentioned above this one docker build -t visualizer . does not create a multi-arch image, just one image that fits the current platform. I've pushed all images built to the Docker Hub hypriot/visualizer repo so everyone can get some ARM images from there.

rpi-visualizer-builds

LGTM!

@ManoMarks We can remove the Dockerfile.aarch64 file after merging this.

@ManoMarks
Copy link
Contributor

Thanks @StefanScherer!

@ManoMarks ManoMarks merged commit d46b2ad into dockersamples:master Jan 2, 2019
@ManoMarks ManoMarks mentioned this pull request Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants