Skip to content

Commit

Permalink
dockerization working
Browse files Browse the repository at this point in the history
  • Loading branch information
lazysegtree committed Jun 6, 2023
1 parent d78af0c commit 6f735f5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
7 changes: 5 additions & 2 deletions full.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ ADD ./oj_django_project /root/oj_django_project
# G++ and python are also preinstalled

# To configure the environment
ARG OS_TYPE=UBUNTU_DOCKERIZED
# This does not works, maybe ENV OS_TYPE UBUNTU_DOCKERIZED will work
# ARG OS_TYPE=UBUNTU_DOCKERIZED

# used --noreload, because otherwise it gets stuck at "Watching for file changes with statsreloader"
# There may be one more way to do so, by Setting ENV variable PYTHONBUFFERED to 1,
Expand All @@ -24,4 +25,6 @@ CMD ["python", "/root/oj_django_project/manage.py", "runserver", "0.0.0.0:8071",
# Build with `docker build -t oj1 -f full.dockerfile .`

# -d for detached ?
# Run with `docker run --name ojcont2 -d -p 8072:8072 oj1`
# Run with `docker run --name ojcont1 -d -p 8071:8071 -e OS_TYPE=UBUNTU_DOCKERIZED oj1`

# goto localhost:8071 and access the website
21 changes: 21 additions & 0 deletions it.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Dockerfile : InTeractively run OJ

FROM nitin12384/django:v1

# Copy problem data
ADD ./data /root/data

# Copy the code and database of OJ
ADD ./oj_django_project /root/oj_django_project

# Since we are using my image nitin12384/django:v1, we already have all requirements installed
# RUN pip install -r /root/oj_django_project/requirements.txt
# G++ and python are also preinstalled

####################################################
# Build with `docker build -t ojit1 -f it.dockerfile .`

# -d for detached ?
####################################################
# Run with `docker run --name ojitcont1 -it -p 8072:8072 -e OS_TYPE=UBUNTU_DOCKERIZED ojit1 /bin/bash`
# Do `python /root/oj_django_project/manage.py runserver 0.0.0.0:8072 --noreload`
Binary file modified oj_django_project/db.sqlite3
Binary file not shown.
2 changes: 2 additions & 0 deletions oj_django_project/problems/backend/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def __init__(self,
import os
ENVIRONMENT = os.getenv('OS_TYPE')

print("Environemt : ", ENVIRONMENT)

if ENVIRONMENT == 'WINDOWS':
cur_config = window_1_config
elif ENVIRONMENT == 'UBUNTU_DOCKERIZED':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,11 @@ class Manager{
const csrftoken = getCookie('csrftoken');

const body_str = this.get_request_body();
const request_url = 'http://localhost:8000/submit/';
const request_url = location.protocol + '//' + location.host + '/submit/' ;
//const request_url = 'https://ee4e-8-20-101-32.eu.ngrok.io/submit/';

Logger.log("request_url = " + request_url) ;

const request = new Request(
request_url,
{
Expand Down

0 comments on commit 6f735f5

Please sign in to comment.