Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm all python/pip related and just use containers to build #846

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions Pipfile

This file was deleted.

230 changes: 0 additions & 230 deletions Pipfile.lock

This file was deleted.

25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,33 @@ There are two ways to build the documentation.
package to use by python.org for dependency
management](https://packaging.python.org/tutorials/managing-dependencies/)

#### Docker
### Default - Docker/Podman

Currently all builds are generated using the
[docker-sphinx](https://github.com/OSC/docker-sphinx/) Docker image. They are
built using the following command from the root of this repo:
[ood-documentation-build](https://github.com/OSC/ood-documentation-build/)
container image. They are built using the following command from the root of this repo:

Note that because we're using `rake`, you'll need to have `ruby` installed on your
system as well as the `rake` gem.

```bash
docker run --rm -i -t -v "${PWD}:/doc" -u "$(id -u):$(id -g)" ohiosupercomputer/ood-doc-build make html
rake build
```

Or use the rake task added:
### Make with Pip/python

The default way to build these files are to use the container (instructions above)
that has all the dependencies sorted out. If however you'd rather install all
the dependencies through python's `pip` (or a different python package manager
like `conda`, `venv` and so on) you can use the `requirements.txt` found in the
[ood-documentation-build](https://github.com/OSC/ood-documentation-build/)
repository.

However this may be flaky and/or brittle way to manage this which is why using
a container is the default mechanism for building these html files.

```bash
rake docker:build
make html
```

## Contributing
Expand Down
35 changes: 26 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# task default: %w[build]

task :default do
system "rake --tasks"
end

namespace :docker do

desc "Build docs using docker"
task :build do
exec 'docker run --rm -i -t -v "${PWD}:/doc" -u "$(id -u):$(id -g)" ohiosupercomputer/ood-doc-build:v2.0.0 make html'
desc "Build docs using docker"
task :build do
if podman?
exec "podman run --rm -it -v #{__dir__}:/doc #{image} make html"
elsif docker?
exec "docker run --rm -it -v '#{__dir__}:/doc' -u '#{user_group}' #{image} make html"
else
raise StandardError, "Cannot find any suitable container runtime to build. Need 'podman' or 'docker' installed."
end
end

Expand All @@ -17,6 +19,21 @@ task :open do
exec '(command -v xdg-open >/dev/null 2>&1 && xdg-open build/html/index.html) || open build/html/index.html'
end

desc "Build docs using pipenv (shortcut)"
task :build => ["pipenv:build"]
task :clean => ["pipenv:clean"]
def user_group
pwnam = Etc.getpwnam(Etc.getlogin)
"#{pwnam.uid}:#{pwnam.gid}"
end

def image
'ohiosupercomputer/ood-doc-build:v2.0.0'
end

def docker?
`which docker 2>/dev/null 2>&1`
$?.success?
end

def podman?
`which podman 2>/dev/null 2>&1`
$?.success?
end
Loading