wownero/contrib/gitian/DOCKRUN.md
luigi1111 44c0470e1e
Merge pull request #8312
5c27fd8 depends: Package cleanup (Howard Chu)
c1d47eb Update randomx: fix Mac linking error (Howard Chu)
02e6af2 Update CI for aarch64 mac build (selsta)
7ea1e21 Make Mac SDK into a regular depends package (Howard Chu)
e81ab9b Silence some protobuf link warnings (Howard Chu)
fe5c2ae Fix arm64 darwin package defs (Howard Chu)
fb68465 Boost 1.64 doesn't recognize arm64 darwin (Howard Chu)
617f908 more... update to clang 9.0.0 (Howard Chu)
83ae3ad Split native_clang out of native_cctools (Howard Chu)
1008318 Update native_cctools for newer SDK support (Howard Chu)
a86c4cb Update to MacOSX SDK 11.1, add Mac M1 (Howard Chu)
2022-05-16 13:52:33 -05:00

113 lines
4.1 KiB
Markdown

Quick Gitian building with docker
=================================
*Setup instructions for a Gitian build of Monero using Docker.*
Gitian supports other container mechanisms too but if you have a Debian or
Ubuntu-based host the steps can be greatly simplified.
Preparing the Gitian builder host
---------------------------------
The procedure here will create a docker container for build preparation, as well as
for actually running the builds. The only items you must install on your own host
are docker and apt-cacher-ng. With docker installed, you should also give yourself
permission to use docker by adding yourself to the docker group.
```bash
sudo apt-get install docker.io apt-cacher-ng
sudo usermod -aG docker $USER
su $USER
```
The final `su` command is needed to start a new shell with your new group membership,
since the `usermod` command doesn't affect any existing sessions.
You'll also need to clone the monero repository and navigate to the `contrib/gitian` directory:
```bash
git clone https://github.com/monero-project/monero.git
cd monero/contrib/gitian
```
Other User Preparation
----------------------
The final step will be to `gpg` sign the results of your build and upload them to GitHub.
Before you can do that, you'll need
* a GitHub account.
If your GitHub account name is different from your local account name, you must
set your GitHub account name for the script to use:
```bash
export GH_USER=<github account name>
```
* PGP keys - if you don't have one already, you can use `gpg --quick-gen-key` to generate it.
* a fork of the [gitian.sigs](https://github.com/monero-project/gitian.sigs/) repo on your GitHub account.
Please follow the directions there for uploading your key first.
**Note:** Please ensure your gpg public key is available to check signatures by adding it to the [gitian.sigs/gitian-pubkeys/](https://github.com/monero-project/gitian.sigs/tree/master/gitian-pubkeys) directory in a pull request.
Building the Binaries
---------------------
The dockrun.sh script will do everything to build the binaries. Just specify the
version to build as its only argument, e.g.
```bash
./dockrun.sh v0.17.3.0
```
The build should run to completion with no errors, and will display the SHA256 checksums
of the resulting binaries. You'll be prompted to check if the sums look good, and if so
then the results will be signed, and the signatures will be pushed to GitHub.
***Note: In order to publish the signed assertions via this script, you need to have your SSH key uploaded to GitHub beforehand. See https://docs.github.com/articles/generating-an-ssh-key/ for more info.***
You can also look in the [gitian.sigs](https://github.com/monero-project/gitian.sigs/) repo and / or [getmonero.org release checksums](https://web.getmonero.org/downloads/hashes.txt) to see if others got the same checksum for the same version tag. If there is ever a mismatch -- **STOP! Something is wrong**. Contact others on IRC / GitHub to figure out what is going on.
Other Options
-------------
This script just runs the [gitian-build.py](gitian-build.py) inside a container named `gitrun`.
You can set other options for that script by setting the OPT variable when running `dockrun.sh`
e.g.
```bash
# Run build processes with 8 threads
OPT="-j 8" ./dockrun.sh v0.17.3.0
```
Post-build
----------
You can examine the build and install logs by running a shell in the container, e.g.
```bash
# Tail running logs
docker exec -it gitrun /bin/bash
tail -F builder/var/install.log
tail -F builder/var/build.log
# Inspect logs, in format install-<OS>.log and build-<OS>.log
docker exec -it gitrun /bin/bash
more builder/var/install-linux.log
more builder/var/build-linux.log
```
You can find the compiled archives inside of the container at the following directory (be sure to replace `v0.17.3.0` with the version being built):
```bash
docker exec -it gitrun /bin/bash
ls -la out/v0.17.3.0/
```
To copy the compiled archives to the local host out of the Docker container, you can run the following (be sure to replace `v0.17.3.0` with the version being built):
```bash
mkdir out
docker cp gitrun:/home/ubuntu/out/v0.17.3.0 out
```