mirror of
https://github.com/lemeow125/Borrowing-TrackerBackend.git
synced 2024-11-17 06:19:26 +08:00
Add docker-related files
This commit is contained in:
parent
2dbd9d2690
commit
ad295a0e6d
3 changed files with 96 additions and 0 deletions
30
Dockerfile
Normal file
30
Dockerfile
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Use the official Python 3.11 image
|
||||||
|
# FROM --platform=arm64 python:3.11.4-bookworm
|
||||||
|
# ARG BUILDPLATFORM
|
||||||
|
FROM python:3.11.4-bookworm
|
||||||
|
|
||||||
|
ENV PYTHONBUFFERED 1
|
||||||
|
|
||||||
|
# Create directory
|
||||||
|
RUN mkdir /code
|
||||||
|
|
||||||
|
# Set the working directory to /code
|
||||||
|
WORKDIR /code
|
||||||
|
|
||||||
|
# Mirror the current directory to the working directory for hotreloading
|
||||||
|
ADD . /code/
|
||||||
|
|
||||||
|
# Install pipenv
|
||||||
|
RUN pip install --no-cache-dir -r linux-requirements.txt
|
||||||
|
|
||||||
|
# Make migrations
|
||||||
|
RUN python equipment_tracker/manage.py makemigrations
|
||||||
|
|
||||||
|
# Run custom migrate
|
||||||
|
RUN python equipment_tracker/manage.py migrate
|
||||||
|
|
||||||
|
# Generate DRF Spectacular Documentation
|
||||||
|
RUN python equipment_tracker/manage.py spectacular --color --file stude/schema.yml
|
||||||
|
|
||||||
|
# Expose port 8000 for the web server
|
||||||
|
EXPOSE 8000
|
23
docker-compose.yml
Normal file
23
docker-compose.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
# Django App
|
||||||
|
django_backend:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: equipmenttracker_backend:latest
|
||||||
|
ports:
|
||||||
|
- "8094:8000" # Expose port 8094 for the web server
|
||||||
|
environment:
|
||||||
|
- PYTHONBUFFERED=1
|
||||||
|
command:
|
||||||
|
[
|
||||||
|
"sh",
|
||||||
|
"-c",
|
||||||
|
"python equipment_tracker/manage.py spectacular --color --file stude/schema.yml && python equipment_tracker/manage.py collectstatic --noinput && python equipment_tracker/manage.py makemigrations && python equipment_tracker/manage.py migrate && python equipment_tracker/manage.py runserver",
|
||||||
|
]
|
||||||
|
volumes:
|
||||||
|
- .:/code # For hotreloading
|
||||||
|
volumes:
|
||||||
|
equipment_tracker:
|
43
requirements.txt
Normal file
43
requirements.txt
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
-i https://pypi.org/simple
|
||||||
|
asgiref==3.7.2; python_version >= '3.7'
|
||||||
|
attrs==23.1.0; python_version >= '3.7'
|
||||||
|
certifi==2023.11.17; python_version >= '3.6'
|
||||||
|
cffi==1.16.0; python_version >= '3.8'
|
||||||
|
charset-normalizer==3.3.2; python_full_version >= '3.7.0'
|
||||||
|
cryptography==41.0.7; python_version >= '3.7'
|
||||||
|
defusedxml==0.8.0rc2; python_version >= '3.6'
|
||||||
|
django==4.2.7
|
||||||
|
django-cors-headers==4.3.1
|
||||||
|
django-extra-fields==3.0.2
|
||||||
|
django-simple-history==3.4.0
|
||||||
|
django-templated-mail==1.1.1
|
||||||
|
django-unfold==0.17.1
|
||||||
|
djangorestframework==3.14.0
|
||||||
|
djangorestframework-simplejwt==5.3.0; python_version >= '3.7'
|
||||||
|
djoser==2.2.2
|
||||||
|
drf-spectacular[sidecar]==0.26.5
|
||||||
|
drf-spectacular-sidecar==2023.10.1
|
||||||
|
idna==3.6; python_version >= '3.5'
|
||||||
|
inflection==0.5.1; python_version >= '3.5'
|
||||||
|
jsonschema==4.20.0; python_version >= '3.8'
|
||||||
|
jsonschema-specifications==2023.11.2; python_version >= '3.8'
|
||||||
|
oauthlib==3.2.2; python_version >= '3.6'
|
||||||
|
pillow==10.1.0
|
||||||
|
psycopg2==2.9.9
|
||||||
|
pycparser==2.21
|
||||||
|
pyjwt==2.8.0; python_version >= '3.7'
|
||||||
|
python-dotenv==1.0.0
|
||||||
|
python3-openid==3.2.0
|
||||||
|
pytz==2023.3.post1
|
||||||
|
pyyaml==6.0.1; python_version >= '3.6'
|
||||||
|
referencing==0.31.1; python_version >= '3.8'
|
||||||
|
requests==2.31.0; python_version >= '3.7'
|
||||||
|
requests-oauthlib==1.3.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
|
||||||
|
rpds-py==0.13.2; python_version >= '3.8'
|
||||||
|
social-auth-app-django==5.4.0; python_version >= '3.8'
|
||||||
|
social-auth-core==4.5.1; python_version >= '3.8'
|
||||||
|
sqlparse==0.4.4; python_version >= '3.5'
|
||||||
|
tzdata==2023.3; sys_platform == 'win32'
|
||||||
|
uritemplate==4.1.1; python_version >= '3.6'
|
||||||
|
urllib3==2.1.0; python_version >= '3.8'
|
||||||
|
whitenoise==6.6.0
|
Loading…
Reference in a new issue