s12v / sns

Fake Amazon SNS
https://hub.docker.com/r/s12v/sns/
Apache License 2.0
126 stars 40 forks source link

Docker image does not run on M1 MacBooks #60

Open bcalmac opened 2 years ago

bcalmac commented 2 years ago

The s12v/sns images from DockerHub are only for linux/amd64 and do not work on the new M1 MacBooks. Those require the linux/arm64 architecture.

I can build the image locally, but it would be nice to have it on DockerHub.

bcalmac commented 2 years ago

Here's my arm64 image for version 0.4.1 if anyone else needs it: https://hub.docker.com/r/bcalmac/sns

bcalmac commented 2 years ago

And the Dockerfile if you want to build it locally:

FROM openjdk:11.0.13-jre-slim

EXPOSE 9911

VOLUME /etc/sns

ENV AWS_DEFAULT_REGION=us-west-2 \
    AWS_ACCESS_KEY_ID=foo \
    AWS_SECRET_ACCESS_KEY=bar \
    DB_PATH=/etc/sns/db.json

ADD "https://github.com/s12v/sns/releases/download/0.4.1/sns-0.4.1.jar" "/sns.jar"

CMD ["java", "-jar", "/sns.jar"]
adelaydeelsevier commented 2 years ago

Thank you @bcalmac - I'm now using your version. In our Go code, I've now got this so it'll run on both types of processor (amd64 and arm64):

  func (c *Containers) getSnsDockerImageName() string {
      r, _ := syscall.Sysctl("sysctl.proc_translated")

      var dockerImageName string
      if c.isAppleSiliconArm64(r) {
          dockerImageName = "bcalmac/sns"
      } else {
          dockerImageName = "s12v/sns"
      }
      return dockerImageName
  }

  func (c *Containers) isAppleSiliconArm64(r string) bool {
      return r == "\x00\x00\x00"
  }

It's a work-around, but it would be great, if you guys were able to merge this into this image so that we don't need to do this. Thanks very much if you can.

warrenseine commented 2 years ago

I've actually published a multiarch version based on @bcalmac's Dockerfile. Feel free to test it.

adelaydeelsevier commented 2 years ago

@warrenseine thank you. it took me a while to get back to looking at this, but I have now tried your version and it works perfectly :-)

warrenseine commented 2 years ago

To be fair, I've migrated my Docker setup to LocalStack so I can have SQS and SNS (and potentially more AWS services) stubbed in a single multiarch container. But I'll keep the image up as it's still useful.

adelaydeelsevier commented 2 years ago

To be fair, I've migrated my Docker setup to LocalStack so I can have SQS and SNS (and potentially more AWS services) stubbed in a single multiarch container. But I'll keep the image up as it's still useful.

That would be great, thanks. If it becomes a bind, I would be happy to fork and maintain it.

TheJosh commented 2 years ago

Our work made a reimplementation of this mock sns service too. Has a few other features such as limited support for subscription filtering, and a debug interface to see the requests and subscriptions.

It's publicly listed on Docker but the source isn't yet public. The source may well be public at some time in the future; I'm going to poke my boss to see if it can be open sourced.

https://hub.docker.com/r/nationalcrimecheck/mock-sns

adelaydeelsevier commented 2 years ago

thanks @TheJosh I will stick with the existing approach for now as the additional features I do not need; if you do manage to make the source available, I'd be happy to look at it.

jameskbride commented 8 months ago

Hello and apologies for the self-advertisement, I've created local-sns as a reimplementation of this project, which includes arm64 support. See https://github.com/jameskbride/local-sns/issues/21 for more details.