Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

chore: add Containerfile with website build dependencies #178

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM fedora-minimal:38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for using fedora-minimal here other than uBlue being related to the Fedora project. From what I'm seeing it's not an official image either, and I doubt it's much smaller (it's probably larger) than the alpine image's 5mb.
Besides, some casual users of containerized tools might have the alpine layers cached already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thoughts, though obviously I didn't contribute the file. :-)

Running a Fedora distro, with Fedora packaging, working on ublue and ucore, all with Fedora packages, I like keeping my toolkit as consistent as possible.

As an example, I use a fedora:38 distrobox image if I'm running on Silverblue:38, but a fedora:37 distrobox image when running on Silverblue:37.

I prefer to use fedora images to minimize drift in versions, library dependencies, etc. So, I generally don't use alpine, arch, debian, or ubuntu images for that reason. Yes, I give up some disk space perhaps, and it does cost a bit more in download bandwidth on occasion, but I have more consistency in the tooling. So it's a trade off.

Now, if I'm developing an image to distribute, where there may be a significant cost to scale of many downloads in a kubernetes cluster, and I'm trying to optimize for small layers or total size, I'll definitely look at the benefits of other base images and if they are worthwhile. That said, I have been bitten by the "python DNS issues" on alpine's musl before, so I'm not always eager to use it there either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was really long and wordy LOL

TL;DR

If we want to publish an image to share for download, use and not tinker with, I lean alpine.

If I'm building locally and think I may need to tinker and integrate with local system, I lean fedora-minimal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mm I thought Fedora minimal was official: https://fedoramagazine.org/building-smaller-container-images/

it is referenced here and in other Fedora documentation and it seems hosted in the Fedora registry

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bsherman is pretty accurate with his comment :)

I prefer consistent tooling so I like Fedora on Fedora in most cases

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mm I thought Fedora minimal was official: https://fedoramagazine.org/building-smaller-container-images/

it is referenced here and in other Fedora documentation and it seems hosted in the Fedora registry

Apparently the one on the Fedora registry should be official, but doesn't not-specifying the registry use docker.io, where there also is a fedora-minimal but which is unofficial. Well, correct me if I'm wrong.


RUN dnf5 install -y poetry git
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to put poetry in a container I'd prefer we use latest upstream vs distro version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point. I realized even F38 doesn't have poetry 2+ in repo, so I can't use it for my projects the way I mentioned above.

Of course, this is sending us down the path of creating a generic poetry image. :-)

If there's a generic poetry image done separate from this, then this PR would change to "install poetry (see website for instructions) or just use this shell alias to run a docker container.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not against that but there's no official image: python-poetry/poetry#4036

I prefer to get my tooling from fedora for the most part and didn't really look at what upstream recommends from installing, if you know how to do that I can amend this PR

The script is really what makes things easy, the container itself isn't too relevant imo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actively working on something to contribute here... not quite ready yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can run the get-poetry setup in the container in the run line here vs the dnf command. I'll wait and see what @bsherman has though

13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ This is the MkDocs repository that hosts the website for [ublue.it](https://ublu

## Developing

### Quick Setup

Use the power of containers so you can quickly contribute and test your changes locally! Just clone this repo and run:

```
./bin/poetry install
./bin/poetry run mkdocs serve
```

The embedded script will automatically create a container with the poetry dependencies so you don't need to install anything on your host!

### Manual Setup

You will need [Python version 3.10 or higher](https://www.python.org/downloads/) and [Poetry](https://python-poetry.org/docs/).

1. Setup project dependencies `poetry install`
Expand Down
17 changes: 17 additions & 0 deletions bin/poetry
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

if ! [ -d "$HOME/.cache/pypoetry" ]; then
mkdir -v "$HOME/.cache/pypoetry"
fi
if ! podman image exists website:builder; then
podman build -t website:builder .
fi

exec podman run --rm -it \
--security-opt label=disable \
-v "$PWD:$PWD" \
-v "$HOME/.cache/pypoetry:/root/.cache/pypoetry" \
-w "$PWD" \
--net=host \
--pid=host \
website:builder poetry "$@"