Skip to content

fix(Docker): Macos docker failure #430

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
merged 4 commits into from
Jun 27, 2023

Conversation

ashokkjag
Copy link
Contributor

Native binary loaded into docker images doesn't work in case of Mac. Hence changed docker to build and create the docker image.

 # stripe-mock > hyperswitch-stripe-mock > make docker-build
docker build -t ""stripe/stripe-mock":latest" -t ""stripe/stripe-mock":ec39425c3ff31dca6993447238e34f243250acc6" .
[+] Building 10.4s (13/13) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                         0.0s
 => => transferring dockerfile: 378B                                                                                                                                         0.0s
 => [internal] load .dockerignore                                                                                                                                            0.0s
 => => transferring context: 97B                                                                                                                                             0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                             1.0s
 => [internal] load metadata for docker.io/library/golang:alpine                                                                                                             1.1s
 => [builder 1/4] FROM docker.io/library/golang:alpine@sha256:fd9d9d7194ec40a9a6ae89fcaef3e47c47de7746dd5848ab5343695dbbd09f8c                                               0.0s
 => [internal] load build context                                                                                                                                            0.0s
 => => transferring context: 29.41kB                                                                                                                                         0.0s
 => [stage-1 1/3] FROM docker.io/library/alpine:latest@sha256:82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe885949ea94d1                                               0.0s
 => CACHED [builder 2/4] WORKDIR /app                                                                                                                                        0.0s
 => [builder 3/4] COPY . .                                                                                                                                                   0.4s
 => [builder 4/4] RUN go build -mod=vendor -o stripe-mock                                                                                                                    8.7s
 => CACHED [stage-1 2/3] RUN apk --no-cache add ca-certificates                                                                                                              0.0s
 => CACHED [stage-1 3/3] COPY --from=builder /app/stripe-mock /bin/stripe-mock                                                                                               0.0s
 => exporting to image                                                                                                                                                       0.0s
 => => exporting layers                                                                                                                                                      0.0s
 => => writing image sha256:863da4fb1c392371d60efc517daba71cfa300cb924128b88763042dc522b2776                                                                                 0.0s
 => => naming to docker.io/stripe/stripe-mock:latest                                                                                                                         0.0s
 => => naming to docker.io/stripe/stripe-mock:ec39425c3ff31dca6993447238e34f243250acc6                                                                                       0.0s
stripe-mock > hyperswitch-stripe-mock > docker run --rm stripe/stripe-mock:latest
stripe-mock master
Routing to 305 path(s) and 452 endpoint(s) with 452 validator(s)
Listening for HTTP at address: [::]:12111
Listening for HTTPS at address: [::]:12112
^C%

Native binary loaded into docker images doesn't work in case of Mac.
Hence changed docker to build and create the docker image.
@CLAassistant
Copy link

CLAassistant commented Jun 21, 2023

CLA assistant check
All committers have signed the CLA.

order_id/txn_id/txn_uuid are mandatory in metadata for hyperswitch.

this change allows hyperswitch to test payment_intent but cards
aren't supported by stripe mock. So instead use `sepa bank debit`

`{
  "amount": 6540,
  "currency": "USD",
  "confirm": true,
  "capture_method": "automatic",
  "capture_on": "2022-09-10T10:11:12Z",
  "amount_to_capture": 6540,
  "customer_id": "StripeCustomer",
  "email": "[email protected]",
  "name": "John Doe",
  "phone": "999999999",
  "phone_country_code": "+1",
  "description": "Its my first payment request",
  "authentication_type": "no_three_ds",
  "return_url": "https://google.com",
  "payment_method": "card",
  "payment_method_type": "credit",
  "payment_method_data": {
    "bank_debit": {
      "sepa_bank_debit": {
          "iban": "1234",
          "bank_account_holder_name": "John",
          "billing_details": {
              "name" : "John Doe",
              "email": "[email protected]"
          }
      }
    }
  },
  "billing": {
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US",
      "first_name": "joseph",
      "last_name": "Doe"
    },
    "phone": {
      "number": "8056594427",
      "country_code": "+91"
    }
  },
  "shipping": {
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US",
      "first_name": "joseph",
      "last_name": "Doe"
    },
    "phone": {
      "number": "8056594427",
      "country_code": "+91"
    }
  },
  "statement_descriptor_name": "joseph",
  "statement_descriptor_suffix": "JS",
  "metadata": {
    "udf1": "value1",
    "new_customer": "true",
    "login_date": "2019-09-10T10:11:12Z",
    "order_id": "123"
  }
}`
@richardm-stripe
Copy link
Contributor

Hello @ashokkjag, thank you for the contribution.

Can you explain/provide more details about the failure you saw (and how to trigger it) that this change is fixing? Presumably in our .goreleaser.yml we are building for both AMD64 and ARM64 https://github.com/stripe/stripe-mock/blob/master/goreleaser.yml#L61-L77, and on my Mac, docker run --rm -it -p 12111-12112:12111-12112 stripe/stripe-mock:latest succeeds. I'd like to be able to trigger the failure myself before I merge a fix.

@ashokkjag
Copy link
Contributor Author

ashokkjag commented Jun 27, 2023 via email

@richardm-stripe
Copy link
Contributor

Ahh I get it. Your shell prompt threw me for a loop but I understand it now!

You could get the "copy locally-built binary over" approach to work like

$ GOOS=linux GOARCH=amd64 make build && make docker-build && make docker-run

but I think I prefer your build-in-docker approach better. Could you remove the fixtures changes from this branch?

@ashokkjag
Copy link
Contributor Author

Sorry Richard, Didn't realize I was commiting my test changes to the PR branch. Reverted the fixtures change.

@richardm-stripe richardm-stripe merged commit 12d28f7 into stripe:master Jun 27, 2023
@richardm-stripe
Copy link
Contributor

Thank you for the contribution @ashokkjag!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants