Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added Dockerfile and entrypoint script to configure API Urls #76

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

darthcircuit
Copy link

I've created a basic Dockerfile that will allow people that are self-hosting the API to also spin up the IDE easily and configure the API URL setting by specifying an environment variable called API_URL

Build the image:
docker build -t judge0-ide .

Run Locally:
docker run -d -p 8080:80 --name judge0-ide -e API_URL="https://api.example.com" judge0-ide

40-env-update.sh Outdated
echo API URL Already set to $API_URL
else
echo Setting API URL to: $API_URL
sed -i "s#var apiUrl = defaultUrl#const apiUrl = '$API_URL'#" /usr/share/nginx/html/js/ide.js
Copy link

@PhilipJonasFranz PhilipJonasFranz Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line causes runtime errors since the variable apiUrl is re-assigned within ide.js. To fix this, replace the const keyword with var.

Also, it seems like the defaultUrl variable is still used in some places. A possible fix would be to also replace this line in the code to a hard-coded value. Same goes for the extraApiUrl variable.

@darthcircuit
Copy link
Author

I'll update that tonight. Thanks!

Taskwize Backend Docker added 2 commits August 21, 2023 10:53
@darthcircuit
Copy link
Author

I've updated my code to remove all references to defaultUrl and put the contents into apiUrl directly. I also changed my const to a var to match your request.

When i get more time, i'll add some changes to allow an environment variable to update the extraApiUrl

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants