Commit ced127da authored by Adam Štěpánek's avatar Adam Štěpánek
Browse files

Add samples and tweak the script a little

parent ffd34d40
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -23,6 +23,9 @@
!*.py
!*.yml

# blobs
!*.png

# configs are a bit of a special case, yes
!/config/*

@@ -32,3 +35,5 @@ jslib/
.vscode/
testout*/
tmp/
tmp_*/
out/
+5 −3
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@ param(
    [int] $height = 1080,
    [switch] $debug = $false)

$dockerTag = "hash"

$inputCount = 0;
if (0 -ne $path.Length) { $inputCount++ }
if (0 -ne $seed.Length) { $inputCount++ }
@@ -35,7 +37,7 @@ elseif (0 -ne $seed.Length) {
$hash = $hash.ToLower();

# verify that the image has been built
docker image inspect cafstep/hash 2>&1 | Out-Null
docker image inspect "$dockerTag" 2>&1 | Out-Null
if (-Not ($?)) {
    Write-Host "Please build the Docker image."
    exit 1
@@ -44,11 +46,11 @@ if (-Not ($?)) {
# create a container
if ($debug) {
    $container = (docker create -it --network none `
            -e WIDTH=$width -e HEIGHT=$height -e DEBUG=true gitlab.fi.muni.cz/xstepan1/hash /hash.sh $hash)
            -e WIDTH=$width -e HEIGHT=$height -e DEBUG=true "$dockerTag" /hash.sh $hash)
}
else {
    $container = (docker create -it --network none `
            -e WIDTH=$width -e HEIGHT=$height gitlab.fi.muni.cz/xstepan1/hash /hash.sh $hash)
            -e WIDTH=$width -e HEIGHT=$height "$dockerTag" /hash.sh $hash)
}
if (-Not($?)) {
    Write-Host "Failed to create a Docker container."
+5 −3
Original line number Diff line number Diff line
@@ -34,11 +34,13 @@ EOF
esac
done

DOCKER_TAG="hash"

WIDTH=${WIDTH:-7016}
HEIGHT=${HEIGHT:-4960}
HASH=${HASH:-"0000000000000000000000000000000000000000000000000000000000000000"}

docker image inspect cafstep/hash >/dev/null 2>&1
docker image inspect "$DOCKER_TAG" >/dev/null 2>&1
if [ $? -ne 0 ]; then
    echo >&2 "Please build the Docker image first."
    exit 1
@@ -46,10 +48,10 @@ fi

if [ -n $DEBUG ]; then
    CONTAINER=$(docker create -it --network none \
            -e WIDTH=$WIDTH -e HEIGHT=$HEIGHT -e DEBUG=true cafstep/hash /hash.sh $HASH)
            -e WIDTH=$WIDTH -e HEIGHT=$HEIGHT -e DEBUG=true "$DOCKER_TAG" /hash.sh $HASH)
else
    CONTAINER=$(docker create -it --network none \
            -e WIDTH=$WIDTH -e HEIGHT=$HEIGHT cafstep/hash /hash.sh $HASH)
            -e WIDTH=$WIDTH -e HEIGHT=$HEIGHT "$DOCKER_TAG" /hash.sh $HASH)
fi

if [ $? -ne 0 ]; then
+133 B
Loading image diff...
+133 B
Loading image diff...
Loading