Skip to content

Commit

Permalink
Add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
canewton committed Jan 1, 2025
1 parent 9887781 commit 0c027cb
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ celerybeat-schedule
# Environments
.env
.venv
database.env
env/
venv/
ENV/
Expand Down
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.10-slim

RUN apt-get update \
&& apt-get -y install libpq-dev gcc \
&& pip install psycopg2

WORKDIR /app

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8010

CMD ["python", "manage.py", "runserver", "0.0.0.0:8010"]
34 changes: 34 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
services:
web:
image: npsat-backend:latest
command: ["python", "manage.py", "runserver", "0.0.0.0:8010"]
volumes:
- .:/app
ports:
- "8010:8010"
depends_on:
- npsat-db

npsat-db:
image: postgres
restart: always
env_file:
- ./database.env
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 1s
timeout: 5s
retries: 10
ports:
- "5432:5432"
volumes:
- npsat-db-data:/var/lib/postgresql/data

adminer:
image: adminer
restart: always
ports:
- 8080:8080

volumes:
npsat-db-data:
1 change: 1 addition & 0 deletions npsat_manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ def process_results(results, model_run):
log.error(
error_message
) # log it as an error too so it goes to all the appropriate handlers
model_run.save()
return
# OK, now we should be safe to proceed
# we're going to make a 2 dimensional numpy array where every row is a well and every column is a year
Expand Down
6 changes: 0 additions & 6 deletions optional-requirements.txt

This file was deleted.

20 changes: 14 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Django==3.1.6
arrow
djangorestframework>=3.11
django-cors-headers
six
waitress
psycopg2
arrow==1.3.0
djangorestframework==3.15.1
django-cors-headers==3.11.0
six==1.16.0
waitress==3.0.0
psycopg2==2.9.9

# Optional Requirements
requests==2.32.3
drf-yasg==1.21.7
pyyaml==6.0.2
uritemplate==4.1.1
numba==0.60.0
numpy==2.0.1

0 comments on commit 0c027cb

Please sign in to comment.