jeftadlvw / git-nest

Nest external repositories into your project without git being bothered.
https://github.com/jeftadlvw/git-nest
Apache License 2.0
1 stars 1 forks source link

🐋 Dockerimage for artifact creation #15

Closed jeftadlvw closed 1 month ago

jeftadlvw commented 2 months ago

Creating an application artifact requires a working shell environment with every tool installed. There should be a Dockerfile that allows building the artifact without all tools being installed.

It should include:

Running the image should

docker build -t git-nest-build -f _docker/Build.Dockerfile .
docker run \
   --user 1000:1000
   -e GOOS=<target os> \
   -e GOARCH=<target architecture> \
   -e GIT_NEST_BUILD_VERSION=<git-nest version> \
   -e GIT_NEST_BUILD_COMMIT_SHA = <git-nest commit hash> \
   -v ./:/git-nest/src:ro \
   -v ./build:/git-nest/build \
   git-nest-build
jeftadlvw commented 1 month ago

There is a new Dockerfile and build script that builds release binaries. It also stores the checksums. Documentation in the README is still missing, as that image does not yet allow setting a custom os and architecture. It's purely for release binaries for now and can be used as stepping stone for a more flexible, less restrictive build environment.

Use it like this:

docker build -t git-nest/build _docker/build && \
docker run \
    -it \
    --rm \
    -e GIT_NEST_BUILD_VERSION="<version tag>" \
    -e GIT_NEST_BUILD_COMMIT_SHA="<commit hash>" \
    -v ./:/git-nest/src:ro \
    -v ./build:/git-nest/build \
    git-nest/build
jeftadlvw commented 1 month ago

I guess you could add another environment variable like TARGET_OVERRIDE that is used instead of the internal default target array. And then each 'os/arch' combination is separated using a whitespace, keeping it nice and simple for external automation.

E.g.:

-e TARGET_OVERRIDE="js/wasm openbsd/amd64 android/arm64"

would override the internal array and build the defined target and calculate their checksums.