nwnxee / unified

Binaries available under the Releases tab on Github
https://nwnxee.github.io/unified
GNU General Public License v3.0
129 stars 92 forks source link

Optionally override docker FROM image with build-args #1751

Closed jakkn closed 1 month ago

jakkn commented 6 months ago

To make building docker images from other branches, like preview, a little easier.

Example usage:

./Scripts/buildimages.sh

## or, if you prefer writing out the build command by hand
docker build . -t nwnxee/unified:build8193.37.2 \
  --build-arg BUILDER_IMAGE="ghcr.io/nwnxee/builder:2186dc2" \
  --build-arg BASE_IMAGE="ghcr.io/urothis/nwserver:8193.37.2"

Defaults are left untouched so this change should not break anything.

Edit 29.03.24:

Scripts/buildimages.sh has been added to make building images easier. Example output (before it runs the docker build commands):

image

Example of the resulting images running the script on branches master and build8193.37

$ docker images

REPOSITORY                                  TAG                                      IMAGE ID       CREATED         SIZE
nwnxee/unified                              build8193.37.2-nwnx-6e5b994f0d4          68908bb022ff   3 hours ago     788MB
nwnxee-base                                 8193.37.2                                5f8f5b26f96e   3 hours ago     519MB
nwnxee/unified                              build8193.36.12-nwnx-a060ee24eea         3b9d4090ec25   3 hours ago     820MB
nwnxee-base                                 8193.36.12                               f782d8b0108b   3 hours ago     517MB
ghcr.io/urothis/nwserver                    8193.36.12                               c7b9c8967ead   10 hours ago    328MB
ghcr.io/urothis/nwserver                    8193.37.2                                0522da296114   10 hours ago    330MB
jakkn commented 6 months ago

It took me a while to realize this was the easiest way to build an image of the preview build for debugging. It's a little hidden so I can write a note about it in the README or somewhere else if you think it should be documented better.

jakkn commented 6 months ago

Wait, now that I read closer I see the resulting image will not necessarily have the run-deps installed that are defined in base.Dockerfile. My local test worked because I only used plugin Events and Object. So it works for simple cases, which is nice, but it may be confusing :thinking:

Edit: amended by introducing Scripts/buildimages.sh