C
C#3mo ago
Alex

How to start test inside docker container from app?

Hi! I'm thinking of building an app similar to leetcode or codewars. The basic idea is user sends you task id and code and I should run tests on it somewhere. I think doing it in docker containers should work. Is it possible to start docker container and pass there input and then somehow get results? Is there a better solution?
10 Replies
Vernon
Vernon3mo ago
Maybe you can try to start the container by passing the environment variable and process it?
docker start ... \
-e VAR_ID="123" \
-e CODE="Some random code" \
...
docker start ... \
-e VAR_ID="123" \
-e CODE="Some random code" \
...
Alex
AlexOP3mo ago
thank you, but I don't know how to start it from the app. Should I use Proccess?
Vernon
Vernon3mo ago
You can simply run the docker command and store the output into a file based on what kind of output you need.
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX3mo ago
TeBeCo
REPL Result: Success
1 == 2
1 == 2
Result: bool
False
False
Compile: 142.761ms | Execution: 16.556ms | React with ❌ to remove this embed.
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Alex
AlexOP3mo ago
Thanks for the detailed answer, I'll look into this project. I don’t yet have a specific plan for how this will work, I’m developing ideas, but the main concept is that I create unit tests in advance for each task (maybe a separate project with tests) and run it somewhere and send back the results to the user
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Alex
AlexOP3mo ago
For now, I will try to make the user wait until the new container starts and check their code
No description
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server