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

Add Dockerfile to build Docker image #1751

Closed
wants to merge 7 commits into from

Conversation

nevets963
Copy link

This PR adds a Dockerfile so that a Docker image can be built and therefore makes it easier to run ord in different environments, OSes, etc.

You can build the image using:

docker build -t casey/ord .

And run it using something like (on Umbrel):

docker run --rm --net umbrel_main_network -p 4000:80 -v $(pwd)/ord-data:/var/lib/ord \
  -v $(pwd)/umbrel/app-data/bitcoin/data/bitcoin/:/var/lib/bitcoind casey/ord \
  --data-dir /var/lib/ord --bitcoin-data-dir /var/lib/bitcoind --rpc-url 10.21.21.8 \
  --index-sats server --http

Note: I would not suggest people run ord using the above command. This is simply what I used to test the Docker image.

@andrewtoth
Copy link
Contributor

Have you tried https://github.com/LukeMathWalker/cargo-chef? It will make subsequent builds much faster. I recommend using it for the dockerfile.

@RarePepeMaximalist
Copy link

RarePepeMaximalist commented Feb 15, 2023

This looks like a great start!

One thing we are going to have to figure out is the best way to pass in parameters for RPC host, network (mainnet, regtest, etc) data directory, etc.

Looking at how this is done for electrs on umbrel, they pass everything as environment variables into the docker image, and then the elecrs app is able to pickup these env vars and use them - https://github.com/getumbrel/umbrel-apps/blob/master/electrs/docker-compose.yml#L30-L36

We might want to do something similar for ord - ie. allow setting configuration variables via environment variable

@nevets963
Copy link
Author

ord could be changed to accept environment variables for configuration. However, this is not needed inorder to provide Docker support.

An example service within a docker-compose.yaml file could look like this (in the case of Umbrel):

services:
  ord:
    image: casey/ord:0.5.0
    restart: on-failure
    command: "--rpc-url ${APP_BITCOIN_NODE_IP} --index-sats --chain ${APP_BITCOIN_NETWORK} server --http"
    volumes:
      - ${APP_DATA_DIR}/data:/var/lib/ord
      - ${APP_BITCOIN_DATA_DIR}:/var/lib/bitcoind:ro

@magicniko
Copy link

hey @nevets963 , I foolishly did not search for Dockerfile PRs before making mine, and also submitted a PR for a dockerfile which generates a smaller docker image, (https://github.com/casey/ord/pull/1765) and was wondering what you thought. I am happy to close my PR if it's not interesting. My docker image is 28MB and yours is 104MB, but likely more usable.

@mroxso
Copy link

mroxso commented Feb 21, 2023

I would prefer a smaller image. But your PR does not include any README @magicniko

@casey
Copy link
Collaborator

casey commented Nov 30, 2023

I want to wait until we have a minimal dockerfile, that people find useful, before starting to dive into docker compose, and adding more features.

We created a PR with a minimal Dockerfile, which still has issues: #2786

@casey casey closed this Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants