Skip to content

3. 🏗 Build and Publish

In this step, you will build your solution into a Docker image, publish it to Docker Hub, and obtain the SHA256 digest required for submission.

Prerequisites

3.1. Build docker image

This step assumes you've already cloned the challenge repository and implemented your solution in the templates/commit directory or in your working directory as mentioned in the previous step.

Arguments

Make sure to replace the placeholders:

  • <USERNAME> with your Docker Hub username.
  • <REPO_NAME> with your repository name on Docker Hub.
  • <VERSION> with your version tag (e.g., 1.0.0, v1, etc.).
docker build -t <USERNAME>/<REPO_NAME>:<VERSION> .
# For example:
docker build -t my_username/my_repo:1.0.0 .

IMPORTANT

To prevent submission theft, please don't include the challenge name or your Discord username in the image name. This precaution is necessary because multiple miners can locate your image on Docker Hub and submit it on your behalf.

3.2. Publish docker image

3.2.1. Create Docker Hub account

Sign up at https://hub.docker.com, if you don't have an account yet.

3.2.2. Docker Login

You need to login using your Docker Hub credentials before pushing the image:

docker login

3.2.3. Push docker image to Docker Hub

docker push <USERNAME>/<REPO_NAME>:<VERSION>
# For example:
docker push my_username/my_repo:1.0.0

3.2.4. Get SHA256 digest as commit hash

FOR SUBMISSION

Save the SHA256 digest of your pushed docker image, which is required for submission for miner commit hash!

docker inspect --format='{{index .RepoDigests 0}}' <USERNAME>/<REPO_NAME>:<VERSION>
# For example:
docker inspect --format='{{index .RepoDigests 0}}' my_username/my_repo:1.0.0

Output:

my_username/my_repo@sha256:abc123def456...

Next step