Skip to content

Commit 117c794

Browse files
Merge pull request #15 from SADiLaR/feature/fix-compose
Fix compose
2 parents ea475ec + d181de0 commit 117c794

File tree

4 files changed

+46
-7
lines changed

4 files changed

+46
-7
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# A minimalist image usable as a base for a production deployment.
12
FROM python:3.12
23

34
# Set environment variables

Dockerfile-dev

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# A development image with extras for development.
2+
# Don't use in production.
3+
FROM python:3.12
4+
5+
# Set environment variables
6+
ENV PYTHONDONTWRITEBYTECODE 1
7+
ENV PYTHONUNBUFFERED 1
8+
9+
# Set work directory
10+
WORKDIR /app
11+
12+
# Install dependencies
13+
COPY requirements.txt /app/
14+
COPY requirements-dev.txt /app/
15+
16+
RUN apt-get update && apt-get -y upgrade
17+
RUN apt-get install --no-install-recommends -y graphviz graphviz-dev
18+
19+
# Install dependencies
20+
RUN pip install --upgrade pip
21+
RUN pip install -r requirements-dev.txt
22+
23+
# Copy project
24+
COPY ./app /app/
25+
26+
# Run the application
27+
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]

docker-compose.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This is is meant for local development, but should give an idea of what you
2+
# can consider in production.
13
version: '3'
24

35
services:
@@ -13,7 +15,9 @@ services:
1315
ports:
1416
- "5432:5432"
1517
web:
16-
build: .
18+
build:
19+
context: .
20+
dockerfile: Dockerfile-dev
1721
container_name: sadilar-terminology-web
1822
command: python manage.py runserver 0.0.0.0:8000
1923
volumes:
@@ -23,9 +27,12 @@ services:
2327
depends_on:
2428
- db
2529
environment:
26-
- DJANGO_DB_HOST=db
27-
- DJANGO_DB_PORT=5432
28-
- DJANGO_DB_NAME=term_db
29-
- DJANGO_DB_USER=sadilar
30-
- DJANGO_DB_PASSWORD=sadilar
31-
- DATABASE_URL=postgresql://sadilar:sadilar@db/term_db
30+
# TODO: dollar signs in the KEY are interpolated, therefore escaped here
31+
# with double "$$". Maybe move to .env file to simplify?
32+
- SECRET_KEY='django-insecure-w!h85bp^$$e8gm%c23r!0%9i7yzd=6w$$s&ic+6!%306&kj8@k*5'
33+
- DEBUG=True
34+
- DB_HOST=db
35+
- DB_PORT=5432
36+
- DB_NAME=term_db # see POSTGRES_DB above
37+
- DB_USER=sadilar # see POSTGRES_USER above
38+
- DB_PASSWORD=sadilar # see POSTGRES_PASSWORD above

requirements-dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-r requirements.txt
2+
django-extensions
3+
pygraphviz
4+
ruff

0 commit comments

Comments
 (0)