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

Optionally override docker FROM image with build-args #1751

Conversation

jakkn
Copy link
Collaborator

@jakkn jakkn commented Mar 28, 2024

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

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

Example usage:
 - 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"
@jakkn
Copy link
Collaborator Author

jakkn commented Mar 28, 2024

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
Copy link
Collaborator Author

jakkn commented Mar 28, 2024

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 🤔

Edit: amended by introducing Scripts/buildimages.sh

@jakkn jakkn force-pushed the optionally-override-docker-from-image-with-build-args branch from 9d4cabb to f55d01a Compare March 29, 2024 10:47
Building the final image takes a bit of care getting all the arguments
right. This script makes building images a little more convenient by
using the version defined by cmake for the given branch, just like the
CI workflows do.
@jakkn jakkn force-pushed the optionally-override-docker-from-image-with-build-args branch from f55d01a to a4869fd Compare March 29, 2024 10:52
@Daztek Daztek merged commit 6282faf into nwnxee:master Aug 16, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants