Skip to content

Commit cd9a85a

Browse files
committed
add Dockerfile and docker-compose.yml
1 parent 5d7db08 commit cd9a85a

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
db.sqlite3
1+
database/db.sqlite3
22
geckodriver.log
33
__pycache__
44
*.pyc

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM python:3.9.7-slim-buster
2+
3+
ENV PYTHONDONTWRITEBYTECODE 1
4+
ENV PYTHONUNBUFFERED 1
5+
6+
WORKDIR /usr/src/app
7+
8+
RUN pip install --upgrade pip
9+
COPY requirements.txt ./
10+
RUN pip install --no-cache-dir -r requirements.txt
11+
12+
COPY . .

docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '3.9'
2+
3+
services:
4+
django-bootstrap-modal-forms:
5+
container_name: django-bootstrap-modal-forms
6+
build: .
7+
command: >
8+
sh -c "python manage.py migrate &&
9+
python manage.py runserver 0.0.0.0:8000"
10+
ports:
11+
- 8000:8000
12+
volumes:
13+
- persist_database:/usr/src/app/database
14+
- ./bootstrap-modal-forms:/usr/src/app/bootstrap-modal-forms
15+
- ./examples:/usr/src/app/examples
16+
- ./setup:/usr/src/app/setup
17+
- ./tests:/usr/src/app/tests
18+
19+
volumes:
20+
persist_database:

setup/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
SECRET_KEY = 'ke2rim3a=ukld9cjh6$d$fb%ztgobvrs807i^d!_whg%@n^%v#'
66
DEBUG = True
77

8-
ALLOWED_HOSTS = []
8+
ALLOWED_HOSTS = ['*']
99

1010
INSTALLED_APPS = [
1111
'django.contrib.admin',
@@ -55,7 +55,7 @@
5555
DATABASES = {
5656
'default': {
5757
'ENGINE': 'django.db.backends.sqlite3',
58-
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
58+
'NAME': os.path.join(BASE_DIR, 'database/db.sqlite3'),
5959
}
6060
}
6161

0 commit comments

Comments
 (0)