Debian Codegraph @

docker/README.md

raw symbols SCIP
1 # Git LFS Linux Docker Builds
2
3 In order to build Linux distribution packages of Git LFS in both the
4 Debian and RPM package formats and across multiple architectures, the
5 GitHub Actions workflows for this repository run package build scripts
6 in a set of Docker containers. The containers are based on Docker images
7 created from the Dockerfiles in the `git-lfs/build-dockers`
8 [repository](https://github.com/git-lfs/build-dockers).
9
10 Each Docker image contains either the `debian_script.bsh` script or
11 `centos_script.bsh` script from the `git-lfs/build-dockers` repository,
12 as appropriate for the expected output package format. The relevant script
13 is executed by default when the image is loaded in a container and builds
14 Git LFS distribution packages for one or more architectures. The packages
15 are written into the `/repo` directory, which is typically a mounted volume
16 in the Docker container.
17
18 ## Building Linux Packages
19
20 The `docker/run_dockers.bsh` script in this repository provides a
21 convenient way to run some or all of the Git LFS Docker builds, assuming
22 the Docker images already exist. (The `build_dockers.bsh` script in
23 the `git-lfs/build-dockers` repository may be used to create the Docker
24 images.)
25
26 When run without arguments, the `run_dockers.bsh` script will run
27 builds for all of the OS versions listed by the `script/distro-tool` utility
28 when it is passed the `--image-names` option. This list should match the
29 available Dockerfiles in the `git-lfs/build-dockers` repository and
30 therefore also the corresponding Docker images created by that repository's
31 `build_dockers.bsh` script.
32
33 The `run_dockers.bsh` script may also be used to run builds for
34 only a subset of the available OS versions, e.g.:
35 ```
36 $ docker/run_dockers.bsh debian_12
37 $ docker/run_dockers.bsh debian_12 rocky_9
38 ```
39
40 The resultant packages of Git LFS will be generated in directories named
41 `./repos/{OS NAME}/{OS VERSION}`. Debian packages are written into
42 those directories, while RPM packages are stored in further levels of
43 subdirectories, e.g., `./repos/rocky/9/RPMS/x86_64`.
44
45 The Docker containers created from each image are removed after use,
46 unless the `AUTO_REMOVE` environment variable is set to a value other
47 than `1`.
48
49 The Docker images will be removed as well if the `--prune` command-line
50 argument is supplied.
51
52 By default, packages are built for the `amd64` architecture. Cross-platform
53 builds may be performed using the `--arch={ARCH}` command-line option if the
54 requested architecture is supported by the build script in the Docker image
55 for the given OS and version. At present, only the `debian_script.bsh`
56 build script in the Debian images supports cross-platform builds.
57
58 If the current user has write permission on the `/var/run/docker.sock`
59 file descriptor or belongs to the `docker` group, the `run_dockers.bsh`
60 script will run the `docker` command directly; otherwise it will attempt
61 to run the command using `sudo`.
62
63 ### Environment Variables
64
65 There are several environment variables which adjust the behavior
66 of the `run_dockers.bsh` script:
67
68 - `AUTO_REMOVE` - Default `1`. Docker containers are automatically deleted
69 upon exit unless this variable is set to a value other than `1`. Retaining
70 a container may be useful for debugging purposes. Note that the container
71 must be removed manually in this case.
72
73 - `DOCKER_OTHER_OPTIONS` - Any additional arguments to be passed to the
74 Docker `run` command.
75
76 ### Docker Image Development
77
78 When developing or debugging the build scripts included in the Docker
79 images, it may be valuable to start an interactive shell in a container
80 instead of letting the build script run by default. To start the Bash shell,
81 for example, use:
82
83 ```
84 $ docker/run_dockers.bsh {OS NAME}_{OS VERSION} -- bash
85 ```
86
87 Any command available in the Docker image may be executed instead of Bash
88 by using the `--` separator, followed by the command to be run.
89
90 ## Adding Docker Images
91
92 To add another Docker image, a new Dockerfile needs to be committed to the
93 `git-lfs/build-dockers` repository, and then a corresponding new entry should
94 be added to the `script/lib/distro.rb` file in this repository with an
95 `image` key whose value matches the OS name and version used in the
96 name of the new Dockerfile.