diff --git a/.gitignore b/.gitignore index 688e3a7..41d06d6 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ teams/migrations forums/__pycache__ forums/migrations .vscode -.env \ No newline at end of file +.env +.python-version diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..56c9fe5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.8.13-slim-bullseye + +RUN mkdir /code +WORKDIR /code +COPY . . +RUN pip install -r requirements.txt +RUN python manage.py makemigrations accounts challenges forums +RUN python manage.py migrate + +EXPOSE 8000 +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8a9d99d --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +docker_build: + docker build -t minictf . + +docker_run: + docker run --rm -it -p 8000:8000 minictf:latest diff --git a/README.md b/README.md index 0e4965a..45ea149 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,24 @@ Discussion Forums -#### Test it locally +#### Dev env setup -###### Requirments +##### Requirments + +> Rename .env.example to .env and change the value of KEY. +> +> **Note**: Keep this value a secret. + +###### Docker Setup + +```bash + make docker_build + make docker_run +``` + +This will start the server at port 8000. + +###### Local Setup ``` python 3.x @@ -51,10 +66,6 @@ django 2.0 Install [Pipenv](https://pypi.org/project/pipenv/) -> Rename .env.example to .env and change the value of KEY. -> -> **Note**: Keep this value a secret. - Want to make this process fast. Switch to [local branch](https://github.com/DivyanshuSahu/miniCTF/tree/local) ###### Install miniCTF diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..027437c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +Django==2.0 +python-dotenv==0.14.0 +pytz==2020.1