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

feat: add Dockerfile #1009

Merged
merged 11 commits into from
Apr 24, 2024
Merged

feat: add Dockerfile #1009

merged 11 commits into from
Apr 24, 2024

Conversation

MegaRedHand
Copy link
Collaborator

Closes #1000

@MegaRedHand MegaRedHand self-assigned this Apr 18, 2024
Dockerfile Outdated

RUN make deps

CMD ["iex", "-S", "mix", "run", "--", "--checkpoint-sync-url", "https://sepolia.checkpoint-sync.ethpandaops.io/", "--network", "sepolia", "--metrics", "--validator-file", "validator_sepolia.txt"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we use parameters or env variables here?

Copy link
Collaborator Author

@MegaRedHand MegaRedHand Apr 19, 2024

Choose a reason for hiding this comment

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

We might want to add support for env vars in place of CLI flags.

diff --git a/.dockerignore b/.dockerignore
index 73d13859..00b5062c 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -15,3 +15,4 @@ tmp/
 .formatter.exs
 .spectest_version
 flake.*
+native/**/target/
diff --git a/Dockerfile b/Dockerfile
index 2441ae97..9e7899dc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,11 @@
-FROM elixir:1.16.2
+FROM golang:1.21.3 AS go_builder
+
+RUN mkdir /libp2p_port
+WORKDIR /libp2p_port
+
+COPY native/libp2p_port /libp2p_port/
+
+FROM elixir:1.16.2-otp-26

 RUN mkdir /app
 WORKDIR /app
@@ -9,10 +16,14 @@ RUN mix local.hex --force

 # copy release to app container
 COPY . .
+COPY --from=go_builder /libp2p_port /app/priv/native/libp2p_port
+
+RUN apt update && apt install -y cmake

-RUN chown -R nobody: /app
-USER nobody
+RUN mix deps.get

-RUN make deps
+# TODO: the leveldb build script from eleveldb doesn't work
+RUN mix compile

+# CMD ["sh"]
 CMD ["iex", "-S", "mix", "run", "--", "--checkpoint-sync-url", "https://sepolia.checkpoint-sync.ethpandaops.io/", "--network", "sepolia", "--metrics", "--validator-file", "validator_sepolia.txt"]
@MegaRedHand MegaRedHand marked this pull request as ready for review April 24, 2024 16:08
@MegaRedHand MegaRedHand requested a review from a team as a code owner April 24, 2024 16:08
mix.exs Show resolved Hide resolved
Dockerfile Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
Copy link
Collaborator

@mpaulucci mpaulucci left a comment

Choose a reason for hiding this comment

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

Lets go! 🚀

@MegaRedHand MegaRedHand merged commit 5a53ee2 into main Apr 24, 2024
18 checks passed
@MegaRedHand MegaRedHand deleted the dockerizing-beam branch April 24, 2024 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Add Dockerfile
2 participants