Skip to content

Conversation

@JoeGruffins
Copy link
Member

@JoeGruffins JoeGruffins commented Dec 25, 2025

Update the docker file to get a certain version of dcrdex from github rather than using the local repo so that we can update the docker file itself without updating the tag.

@JoeGruffins JoeGruffins requested a review from peterzen December 26, 2025 07:49
@JoeGruffins JoeGruffins marked this pull request as ready for review December 26, 2025 07:53
@JoeGruffins
Copy link
Member Author

Also removed the Dockerfile.release file because it seems redundant. Do we need it?

Copy link
Member

@peterzen peterzen left a comment

Choose a reason for hiding this comment

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

LGTM. Dockerfile.release is not used elsewhere at present AFAIK; safe to remove.

Copy link
Contributor

@JustinBeBoy JustinBeBoy left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 22 to 23
RUN apk add git && \
git clone --depth 1 --branch $VERSION https://github.com/decred/dcrdex.git && \
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should validate the version before cloning it.

git ls-remote --refs --tags https://github.com/decred/dcrdex.git | grep -q "refs/tags/$VERSION" || \
    { echo "ERROR: Version $VERSION does not exist"; exit 1; } && \
    git clone --depth 1 --branch $VERSION https://github.com/decred/dcrdex.git

Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary complexity IMO, docker build will bail out if git clone fails

@peterzen
Copy link
Member

On a second thought, I'm not sure that changing the Dockerfile this way is an entirely good idea. The --build-arg/ git clone vs COPY makes it difficult to work/debug build issues on the current clone. This workflow can be triggered multiple times manually in GH, in case the build fails intermittently the action can be triggered again.

@JoeGruffins
Copy link
Member Author

makes it difficult to work/debug build issues on the current clone.

Do you mean using docker for building master?

@peterzen
Copy link
Member

peterzen commented Dec 27, 2025

Do you mean using docker for building master?

More like when you're debugging something related to the dockerized version or related to the build itself, and you want to build an image locally off of the current clone. Works OK in production in GH workflows, though the additional git clone slows things down. The dcrd docker image builds the same way (I guess this PR borrows from that Dockerfile) but this adds complexity that's not really necessary here.

There is also another element I just recalled - Umbrel images are expected to be able to build in an offline environment in order to be eligible to be added to the official app store (as a safeguard against supply chain attacks) - so no network requests within the Dockerfile. This does not affect Bisonwallet at present in the context of the community app store but essentially disqualifies the app to pass the eligibility test, should we ever want to apply for an official app store entry.

Why did you feel this change was required?

@JoeGruffins
Copy link
Member Author

I did not look at dcrd, this just seems to be what's best.

Why did you feel this change was required?

  1. We can't update the docker file without updating the tag if we have to checkout the tag first. This makes things very awkward.
  2. Currently it copies over the user's entire dcrdex folder, which may have sensitive information related to testing, like providers json files that have an api secret. This is also copying the entire local .git history? Probably fine since the instructions are to clone a new repo first.
  3. When researching almost all suggestions were to get the tag from git if we want to build at the tag.

so no network requests within the Dockerfile

I did not know this part. I'm a little confused though aren't all the docker parts downloaded? We can include a sha comparison but I guess that wouldn't matter?

@JoeGruffins
Copy link
Member Author

Where are the official rules, I see this https://github.com/getumbrel/umbrel-apps?tab=readme-ov-file#a-good-dockerfile

Uses remote assets that are verified against a checksum.

We can do that.

@peterzen
Copy link
Member

Where are the official rules, I see this https://github.com/getumbrel/umbrel-apps?tab=readme-ov-file#a-good-dockerfile

Uses remote assets that are verified against a checksum.

Right - nevermind I mixed up Umbrel with the Snap package build, the latter needs the offline build. Apologies for the confusion, it's been a while.

@peterzen
Copy link
Member

1. We can't update the docker file without updating the tag if we have to checkout the tag first. This makes things very awkward.

The Dockerfile doesn't need updating for releases, the GH workflow uses the current git ref to tag the docker image:

--tag ${{ env.IMAGE_NAME }}:${{ github.ref_name }} \

To publish the release for Umbrel this needs to be updated:

image: decred/dcrdex:v1.0.3@sha256:6c504ae6570ce7753d345cae3c592b411c903430405e1ab9379271124fc44088

If this update goes in as a separate PR after the release then it's less awkward. /dcrdex-umbrel really ought to live in a separate repo, the current situation is not ideal.

Does this make sense?

2. Currently it copies over the user's entire dcrdex folder, which may have sensitive information related to testing, like providers json files that have an api secret. This is also copying the entire local .git history? Probably fine since the instructions are to clone a new repo first.

It's a 2 stage build; stage 1 copies in the current clone, stage 2 starts with a blank image and copies over only the binary from stage 1. So nothing can and up in the final image unless explicitly populated from client/Dockerfile. Sensitive stuff can be added to .dockerignore which docker will then ignore during the COPY in stage 1.

3. When researching almost all suggestions were to get the tag from git if we want to build at the tag.

There are situations like when a docker image is built from several source repos etc, that's when that pattern comes in handy.

@JoeGruffins
Copy link
Member Author

Just updating the docker image we point to. Maybe the current flow is best for umbrel. Not changing for now.

@JoeGruffins
Copy link
Member Author

JoeGruffins commented Dec 30, 2025

The Dockerfile doesn't need updating for releases, the GH workflow uses the current git ref to tag the docker image:

We had to do this at one point 85a5783

So sometimes we need to update the Dockerfile right? We were able to get that into the patch but there may be times when we cannot without updating the patch. Also all the versions before we got it in should be broken now.

@peterzen
Copy link
Member

So sometimes we need to update the Dockerfile right? We were able to get that into the patch but there may be times when we cannot without updating the patch.

Right, for dependencies etc but a new release on its own doesn't need a Dockerfile update.

Also all the versions before we got it in should be broken now.

You mean the previous Umbrel releases before /dcrdex-umbrel was imported?

@JoeGruffins
Copy link
Member Author

You mean the previous Umbrel releases before /dcrdex-umbrel was imported?

Was there not a release before that change? Anyway merging.

@JoeGruffins JoeGruffins merged commit b579778 into decred:master Dec 31, 2025
5 checks passed
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.

3 participants