-
Notifications
You must be signed in to change notification settings - Fork 141
build: Implement docker build #1774
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
Conversation
OmniBlade
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the build script not live under scripts and the dockerbuild folder not live under resources rather than both ending up in the top level?
.gitignore
Outdated
| *.user | ||
| *.ncb | ||
| /build* | ||
| !/build.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change to .gitignore is no longer required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the docker files should not be too far from the build script but I will split it
But moving it like this causes a problem with the working dir
I can either :
- implement it to be run from root ie:
scripts/dockerbuild.sh - or from inside the script folder
having both will need some folder search magic
This will end up to be confusing
having it at least the build script in root makes easier to implement more usable and consistent -> there are 5 build related files and folders in the root (build,cmake....)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script shouldn't care what path its run from, it should detect its path and work out where other stuff is relative to itself. Relying on the current working dir is normally a bad idea and will just generate support requests when people run it wrong.
You already make use of basename to get the script name, using dirname will get you the containing folder (lets say scripts) and running direname on that folder would get you the top level project folder. You can then use that to construct the other paths you need.
|
Dockefile needs to be put on the root of the source files. For security reasons you can not copy files from parent container(Dockerfile) path. A malicious attacker could otherwise do path traversal. 'COPY ../../etc/passwd passwd' |
|
I can do it but please agree on the final file structure before I finish the PR /scripts/dockerbuild.sh or /scripts/dockerbuild.sh |
|
Both look ok to me. Any reason dockerbuild files are split into scripts and resources folder? Perhaps just put them into single location? |
|
What would technically work? Dockerfile needs to be in root? |
|
Second option looks most appropriate to me, Dockerfile isn't using anything from the root of the repo so shouldn't need to be there as far as I can tell, it just looks relatively for the entrypoint script. |
|
I'm not averse to them living entirely under scripts or resources. My thinking behind the split is that scripts is just for scripts intended to be used by end users while resources are for useful stuff used by other things (in this case the docker build script). |
|
@OmniBlade @xezon I think the files should be together either in root, scripts or resources. I like the current structure because the build script is directly in root but I dont mind moving them. I just would like to know where before I have to refactor the PR again Thanks |
The DockerFile only needs access to entrypoint.sh which is already in the same folder in the proposed structure. The source tree is mounted in at runtime, either by the dockerbuild script or by a user manually invoking running the container after it is built. The build script can go under scripts or in the resources folder next to the DockerFile (preferrably not in the root) and should be set up such that it does not rely on the working directory being a specific directory which will require a bit of bash code to discover its absolute location and then work backwards to the source root. |
|
lots of oss have Dockerfile in root. I belive it deserves the spotlight. |
|
If it was a web application that was primarily built and distributed as a containerised app I might agree. However this is a helper container for cross platform builds on an old tool chain we want to stop using in the near future. Most people are not going to need to use it and it isn't part of the main build system. Further, it might be decided in the future that additional dockerised build systems are required for other platforms, are they all going to live in the root? |
|
@OmniBlade can this be merged ? |
|
Sorry, I just wanted to test the most recent commit myself before I approved it which I have now done. |
| done | ||
|
|
||
|
|
||
| docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) $RESOURCES_DIR/dockerbuild -t zerohour-build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mentions "zerohour-build". Does this mean it only builds zero hour, never generals?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested and it builds both targets, I believe its just the name the built container is assigned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can name it to clarify that both games are in there?

Improved the original pr from @PiecePaperCode