informatiCup / informatiCup2022

Abfahrt! Der InformatiCup 2022
23 stars 3 forks source link

Docker run CI input argument missing #26

Closed cbl closed 2 years ago

cbl commented 2 years ago

It seems to me that the input argument is missing in the CI system. The web interface shows that the following arguments are passed to the docker run command:

--rm --interactive --memory 2g --memory-swap 2g --cpus 2.000 --network none --name [redacted] [redacted]

so the reducted arguments are the name of the container and the tag of the build, the third [redacted] should be the input or am i missing something here?

When I am running the same command with the input after all those arguments it works just fine.

My docker image runs a run.sh as an entry point using ENTRYPOINT like pointed out in stackoverflow.com/a/40312311, which has the following content:

#!/bin/bash
./bath/to/binary "$@"
Top-Ranger commented 2 years ago

Hi,

as specified in the task, the input must be read from stdin and the output must be written to stdout. There is no such thing as an input file.

See https://github.com/informatiCup/informatiCup2022/issues/2 for more information on stdin.

I wish you and all participants a happy x-mas.

sedengel25 commented 2 years ago

Hi,

building up on that issue I was wondering how can I "simulate" on my local machine what the CI is doing? Using the docker run command shown above, the docker image I built before can be run. Unfortunately I don't understand how to pass content using the standard input. The program is written in C++ and expects content via "cin", which works fine using the command line. Do you have any ideas?

Thanks a lot in advance!

Top-Ranger commented 2 years ago

Hi,

just pipe the content of the input file into the docker command. Here are some examples.

Unix:

cat INPUT_FILE.txt | docker run -{additional flags} {Container}

Unix oder cmd.exe

docker run -i {additional flags} {Container} < INPUT_FILE.txt

Powershell:

Get-Content INPUT_FILE.txt | docker run -i {additional flags} {Container}
cbl commented 2 years ago

@Top-Ranger thank you for the quick reply. I confused the standard input with a terminal argument...

Merry Christmas from my side as well! :)

sedengel25 commented 2 years ago

@Top-Ranger also thanks for the quick reply, it worked!