Skip to content

Commit

Permalink
Addressing request to move all into a dockerbuild directory
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Cox <[email protected]>
  • Loading branch information
joshuacox committed Nov 18, 2023
1 parent 71575aa commit 9157365
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 35 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
*.rpm
*.log
x86_64/*
tmp/*
output/*
8 changes: 4 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ So how to build it?
There is a simple build.sh script included to show the sequence that I used to build the image.

```
./build.sh
./dockerbuild/build.sh
```

Which should end in something like:

```
sudo find ./tmp -name vojtux_38.iso
./tmp/lmc-result-DEADBEEF_cg/vojtux_38.iso
sudo find ./dockerbuild/output -name vojtux_38.iso
./dockerbuild/output/vojtux_38.iso
```

Your vojtux_38.iso should be listed as above, where DEADBEEF will be some unique ID.
Your `vojtux_38.iso` should be listed as above.

## What is actually done?

Expand Down
28 changes: 0 additions & 28 deletions build.sh

This file was deleted.

3 changes: 3 additions & 0 deletions dockerbuild/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.log
tmp/*
output/*
3 changes: 2 additions & 1 deletion Dockerfile → dockerbuild/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ RUN sudo dnf install -yq lorax-lmc-novirt pykickstart \
COPY ./ /target
WORKDIR /target

CMD /target/start.sh
CMD ls -Rl /target
CMD /target/dockerbuild/start.sh
50 changes: 50 additions & 0 deletions dockerbuild/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh
# Build a vojtx image in a docker container

OUTPUT=$(pwd)/dockerbuild/output
TMP=$(pwd)/dockerbuild/tmp

prepdir () {
mkdir -p $1
chmod 777 $1
}

if [ "$0" != "dockerbuild/build.sh" && "$0" != "./dockerbuild/build.sh" ]; then
echo 'wrong usage! Please call from the vojtux root directory! e.g.'
echo 'dockerbuild/build.sh'
if [ -z "$1" ]; then
exit 1
elif [ "$1" == '--force' ]; then
echo 'using the force, soft fail'
else
exit 1
fi
fi

set -eu
prepdir $TMP
prepdir $OUTPUT
trap "rm -rf $TMP" EXIT

if [ -f "dockerbuild/Dockerfile" ]; then
docker build \
-t vojtux \
-f dockerbuild/Dockerfile \
./
else
echo 'Dockerfile not found'
exit 1
fi

# we need priliged for the loopbacks and losetup to work
# likewise /dev needs to be mounted in also for the loopbacks
# but does not present to be a problem till after the squashfs runtime
docker run \
--privileged=true \
-it --rm \
-v /dev:/dev \
-v $TMP:/live/tmp \
-v $OUTPUT:/output \
vojtux:latest

sudo find $OUTPUT -name vojtux_38.iso
File renamed without changes.

0 comments on commit 9157365

Please sign in to comment.