Skip to content
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

Docker file #45

Merged
merged 10 commits into from
Feb 12, 2024
Merged

Docker file #45

merged 10 commits into from
Feb 12, 2024

Conversation

nialexsan
Copy link
Contributor

Closes: #???

Description

Dockerfile for a build to deploy


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@@ -2,8 +2,8 @@ name: "Deploy EVM Gateway to Cloud Run"

on:
push:
branches:
- main
# branches:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this intentional? Do we want them to be commented-out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll revert these changes, they were only for testing

@@ -45,7 +45,7 @@ func TestServerJSONRPCOveHTTPHandler(t *testing.T) {
blockchainAPI := api.NewBlockChainAPI(config, store, mockFlowClient)
supportedAPIs := api.SupportedAPIs(blockchainAPI)
srv.EnableRPC(supportedAPIs)
srv.SetListenAddr("localhost", 8545)
srv.SetListenAddr("", 8545)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm curious, did you encounter a problem with "localhost"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, there was an issue in cloud run
it's a specific requirement for cloud run

The ingress container within an instance must listen for requests on 0.0.0.0 on the port to which requests are sent.

https://cloud.google.com/run/docs/container-contract

Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment as above about the port needing to be an injected variable

Dockerfile Outdated
RUN CGO_ENABLED=0 go build -o evm-gateway ./cmd/server/main.go
RUN chmod a+x evm-gateway
RUN chmod a+x ./scripts/run.sh
RUN git clone https://github.com/m-Peter/flow-cli-custom-builds.git
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor, I run into a glitch the first time building the image locally:

> [builder 10/10] RUN git clone https://github.com/m-Peter/flow-cli-custom-builds.git:
0.344 Cloning into 'flow-cli-custom-builds'...
66.27 error: 3872 bytes of body are still expected
66.28 fetch-pack: unexpected disconnect while reading sideband packet
66.29 fatal: early EOF
66.31 fatal: fetch-pack: invalid index-pack output
------
ERROR: failed to solve: executor failed running [/bin/sh -c git clone https://github.com/m-Peter/flow-cli-custom-builds.git]: exit code: 128

Maybe another alternative could be:

RUN wget https://github.com/m-Peter/flow-cli-custom-builds/raw/main/flow-x86_64-linux-
RUN chmod a+x flow-x86_64-linux-

With the 2nd attempt, I was able to build the image and run a container, so it is not a big deal.

Copy link
Collaborator

@m-Peter m-Peter left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀
I built an image locally and ran the container. It worked very well 👏

COPY --from=builder /flow-evm-gateway/flow.json /flow-evm-gateway/flow.json
COPY --from=builder /flow-evm-gateway/api/cadence/transactions/create_bridged_account.cdc /flow-evm-gateway/create_bridged_account.cdc
COPY --from=builder /flow-evm-gateway/scripts/run.sh /flow-evm-gateway/run.sh
EXPOSE 8545
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll need to expose this so it can be templated and set externally

@@ -45,7 +45,7 @@ func TestServerJSONRPCOveHTTPHandler(t *testing.T) {
blockchainAPI := api.NewBlockChainAPI(config, store, mockFlowClient)
supportedAPIs := api.SupportedAPIs(blockchainAPI)
srv.EnableRPC(supportedAPIs)
srv.SetListenAddr("localhost", 8545)
srv.SetListenAddr("", 8545)
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment as above about the port needing to be an injected variable

@@ -460,7 +460,7 @@ func TestServerJSONRPCOveWebSocketHandler(t *testing.T) {
blockchainAPI := api.NewBlockChainAPI(config, store, flowClient)
supportedAPIs := api.SupportedAPIs(blockchainAPI)
srv.EnableWS(supportedAPIs)
srv.SetListenAddr("localhost", 8545)
srv.SetListenAddr("", 8545)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment

@@ -182,7 +182,7 @@ func runServer(config *api.Config, store *storage.Store, logger zerolog.Logger)
srv.EnableRPC(supportedAPIs)
srv.EnableWS(supportedAPIs)

srv.SetListenAddr("localhost", 8545)
srv.SetListenAddr("", 8545)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same again


# Run the second process

./flow-x86_64-linux- transactions send /flow-evm-gateway/create_bridged_account.cdc 1500.0 --network=emulator --signer=emulator-account && ./evm-gateway
Copy link
Contributor

Choose a reason for hiding this comment

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

We will need to be able to pass in the network to be used, whether emulator or other network

@nialexsan nialexsan merged commit ff69c7e into main Feb 12, 2024
1 check passed
@m-Peter m-Peter deleted the nialexsan/docker branch March 8, 2024 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants