WebSocketGaugeServer - Build Docker image
How to build image
Install Docker and simply build by Dockerfile
docker build --tag (your tag name) .
If you want to build on non-x64 enviromnent, you may have to change ---platform
option of the Dockerfile
.
# Select architecture of build platform
# Change platform option for your build platform
FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build
How to build multi-platform image by buildx
Dockerfile
of this source repository can be used to build multi-platform image with buildx
.
- Install qemu Docker image and setup builder
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes docker buildx rm builder docker buildx create --name builder --driver docker-container --use docker buildx inspect --bootstrap
- Change
--platform
option ofDockerfile
(This step is not needed if you build the image on linux-x64)# Select architecture of build platform # Change platform option for your build platform FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build
- Login to docker hub (to upload image to docker hub)
(This may not be needed to build the image to local)
docker login
- Finally, build the image with
buildx
docker buildx build --tag (your image tag name) --platform linux/amd64,linux/arm64,linux/arm/v7 --push .
Reference
- https://stackoverflow.com/questions/60080264/docker-cannot-build-multi-platform-images-with-docker-buildx