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 Initialize & Start Environment

Run First

Before building your final image, ensure the environment is running correctly with the default template.

This confirms the connection between the challenge container and the miner container.

1. Activate the Miner Service

Copy the development compose override to the project root:

cp templates/compose/compose.override.dev.yml compose.override.yml

2. Start Services

Run the compose helper script:

./compose.sh start

3. Confirm Execution

Verify both services are running.

Run:

docker ps -a

You should see two containers:

  • challenge-api
  • miner-commit-api

3.2 Configure & Build Miner Image

You must claim the miner image by updating it with your own Docker Hub information and building it using the correct context.

DO NOT BUILD FROM THE ROOT DIRECTORY

Do not run the following command from the project root:

docker build .

This will either fail or build the wrong image.

Always build through Docker Compose, which ensures the correct build context:

cd ./examples/miner_commit
docker compose build miner-commit-api

Locate the miner-commit-api service and update the image field to your Docker Hub repository.

Crucial: Do Not Edit Challenge API

Only modify the image field under miner-commit-api.

Do not change anything inside the challenge-api service.

miner-commit-api:
  # CHANGE THIS to your Docker Hub repository
  image: <USERNAME>/<REPO_NAME>:<VERSION>

  # DO NOT CHANGE THIS (points to your solution code)
  build:
    context: ./examples/miner_commit

Build only the miner container:

docker compose build miner-commit-api

This builds your solution container using the correct directory.

Prevent Submission Theft

Do not include the challenge name or your Discord username in the image name.

Other miners can scan Docker Hub and submit your image on your behalf.

3.3 Verify Locally (Sanity Check)

Before publishing your image, confirm that the container is running with your custom image name.

1. Restart Services

./compose.sh restart

2. Verify the Image

Run:

docker ps -a

Check the IMAGE column for the miner container.

Correct

miner-commit-api shows:

<USERNAME>/<REPO_NAME>:<VERSION>

Wrong

It shows:

redteamsubnet61/rest-my-challenge

This means you are accidentally running the challenge image instead of your miner solution.


3.4 Publish Docker Image

3.4.1 Create Docker Hub Account

Create an account if you do not already have one:

https://hub.docker.com

3.4.2 Docker Login

Authenticate with Docker Hub:

docker login

3.4.3 Push Docker Image

Push your image to Docker Hub:

docker push <USERNAME>/<REPO_NAME>:<VERSION>

Example:

docker push my_username/my_repo:1.0.0

3.4.4 Get SHA256 Digest (Commit Hash)

FOR SUBMISSION

Save the SHA256 digest of your pushed Docker image.

This value is required as your miner commit hash when submitting your solution.

Run:

docker inspect --format='{{index .RepoDigests 0}}' <USERNAME>/<REPO_NAME>:<VERSION>

Example:

docker inspect --format='{{index .RepoDigests 0}}' my_username/my_repo:1.0.0

Example output:

my_username/my_repo@sha256:abc123def456...

Next Step