cmehay / docker-tor-hidden-service

232 stars 53 forks source link

multi-platform image builds #92

Open lizzthabet opened 1 year ago

lizzthabet commented 1 year ago

hi @cmehay! have you thought about supporting multi-platform builds of tor-hidden-service?

i've been experimenting with multi-platform images since i'm running a containerized onion service from a raspberry pi.

i was able to build and push a multi-platform image by following the buildx docs to create a new builder using the docker-container driver. this is what that looks like in practice as another makefile task:

publish-multiplatform:
  docker buildx build --platform linux/amd64,linux/arm64 --build-arg tor_version=$(TOR_VERSION) --build-arg torsocks_version=$(TORSOCKS_VERSION) -f Dockerfile --tag lizz0thabet/tor-hidden-service:$(CUR_TAG) --tag lizz0thabet/tor-hidden-service:latest --push .

and here's the image on hub that i'm using on my pi.

there are a couple ways this ^ particular approach might introduce inconsistencies / friction into the existing workflow. right now, docker compose doesn't support multi-platform builds, so the compose file has to be translated into a docker build command. the second thing is that at the moment buildkit only supports multi-platform manifests when pushing images, so you have to build and push in the same step.

these may be acceptable compromises / changes to the existing workflows, or they may not be! i appreciate the work you've put in to build, maintain, and document tor-hidden-service.