> For the complete documentation index, see [llms.txt](https://docs.openg2p.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openg2p.org/operations/deployment/deployment-guide/automatic-build-and-upload-of-private-dockers.md).

# Automatic Build and Upload of Private Dockers

Guide to build and upload on Docker hub from private Github repositories

## Docker Hub

1. Create a private repository on Docker Hub for all dockers that will be uploaded.
2. Make sure a 'bot' user is created on Docker Hub that has read/write access to these repositories
3. Create an access token for this user. (Refer Docker Hub docs)

## Creation of Github actions

1. Clone the private repo on the command line (example, `openg2p-myrepo`)
2. Under `openg2p-myrepo/.github` folder create the following folder structure

```
.github/
├── docker_packages
└── workflows
```

3. Inside `docker_packages` folder create package files for modules like Social Registry, PBMS, etc. See [sample package files](https://github.com/OpenG2P/openg2p-packaging/tree/main/samples/sample-packages-for-private-repo). Replace `openg2p-myrepo` with your private repo name.
4. Run following command in your private repo root folder `openg2p-myrepo/:`

```sh
git submodule add https://github.com/openg2p/openg2p-packaging .github/docker_packaging
```

This will clone `openg2p-packaging` repo into the `docker_packaging` folder. The folder structure will look like

<pre><code>.github/
├── docker_packages
<strong>|── docker_packaging
</strong>└── workflows
</code></pre>

5. Inside `workflows` folder copy [`docker_build.yml`](https://github.com/OpenG2P/openg2p-packaging/blob/main/samples/docker-build.yml) and modify the following for your repo:
   1. Set `SERVICE_NAME` to name of your Docker Hub repository
   2. Replace `openg2p-myrepo` with your repo name
6. Check in all the above.

## Enabling Github actions

1. Under *Secrets and variables->Actions* create the following secrets:
   * DOCKER\_HUB\_ACTOR: Docker Hub user id that has permission to read/write the above registry
   * DOCKER\_HUB\_ORGANIZATION: Organization under which your private repo resides
   * DOCKER\_HUB\_TOKEN: Access token for this user on Docker Hub
2. Under your private repo *Settings->Actions->General,* enable "**Allow all actions and reusable workflows**"

## Run

The above workflow will automatically run when a PR is merged into the private repo. Dockers will be built and posted to Docker Hub.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.openg2p.org/operations/deployment/deployment-guide/automatic-build-and-upload-of-private-dockers.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
