Skip to content

Commit 45d041f

Browse files
committed
Docker building
Changes to be committed: modified: Dockerfile modified: admin_only/bco_api.conf modified: bco_api/bco_api/settings.py modified: bco_api/server.conf new file: docker-compose.yml
1 parent 923f990 commit 45d041f

File tree

6 files changed

+42
-23
lines changed

6 files changed

+42
-23
lines changed

Dockerfile

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:21.04
1+
FROM ubuntu:22.04
22
LABEL org.opencontainers.image.source https://github.com/biocompute-objects/bco_api
33
ENV DEBIAN_FRONTEND=noninteractive
44

@@ -7,29 +7,27 @@ ENV DJANGO_SUPERUSER_PASSWORD="BioCompute123"
77
ENV DJANGO_SUPERUSER_USERNAME="BioComputeSuperUser"
88
ENV DJANGO_SUPERUSER_EMAIL="[email protected]"
99

10-
RUN apt-get -qq update && apt-get install -y python3 python3-dev python3-pip
10+
RUN apt-get -qq update && apt-get install -y python3.9 python3-dev python3-pip
1111

12-
RUN python3.9 -m pip install --upgrade pip
12+
RUN python3 -m pip install --upgrade pip
1313

1414
WORKDIR /biocompute_api
1515

1616
COPY requirements.txt .
17-
COPY apitests.py .
18-
COPY apitests_new.py .
1917

20-
RUN python3.9 -m pip install -r requirements.txt
18+
RUN python3 -m pip install -r requirements.txt
2119

22-
COPY admin_only ./admin_only
20+
# COPY admin_only ./admin_only
2321
COPY bco_api ./bco_api
2422
#COPY static ./static
25-
COPY docs ./docs
23+
# COPY docs ./docs
2624

2725
WORKDIR /biocompute_api/bco_api
2826

29-
RUN python3.9 manage.py migrate
30-
RUN python3.9 manage.py loaddata ./api/fixtures/metafixtures.json
31-
RUN python3.9 manage.py createsuperuser --no-input
27+
RUN python3 manage.py migrate
28+
RUN python3 manage.py createsuperuser --no-input
3229

30+
EXPOSE 8000
3331
#CMD ["bash"]
34-
ENTRYPOINT ["python3.9", "manage.py", "runserver"]
32+
ENTRYPOINT ["python3", "manage.py", "runserver"]
3533
CMD ["0.0.0.0:8000"]

admin_only/bco_api.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
erver {
2+
server {
33
listen 80;
44
server_name 161.253.252.154 test.portal.biochemistry.gwu.edu;
55
return 301 https://$host$request_uri;

bco_api/bco_api/settings.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@
9696
CORS_ORIGIN_ALLOW_ALL = True
9797

9898
# Use the REST framework
99-
# Source: https://www.django-rest-framework.org/api-guide/authentication/#setting-the-authentication-scheme
100-
# Source: https://www.django-rest-framework.org/api-guide/permissions/#setting-the-permission-policy
10199
REST_FRAMEWORK = {
102100
"DEFAULT_AUTHENTICATION_CLASSES": [
103101
"rest_framework.authentication.TokenAuthentication"
@@ -200,7 +198,7 @@
200198
DATABASES = {
201199
"default": {
202200
"ENGINE": "django.db.backends.sqlite3",
203-
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
201+
"NAME": server_config["DATABASES"]["path"],
204202
}
205203
}
206204

@@ -268,8 +266,6 @@
268266
OBJECT_NAMING[i] = server_config["OBJECT_NAMING"][i]
269267

270268
# emailing notifications
271-
272-
# e-Mail settings are explained at https://stackoverflow.com/questions/46053085/django-gmail-smtp-error-please-run-connect-first
273269
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
274270
EMAIL_HOST = "localhost"
275271
EMAIL_PORT = 25

bco_api/server.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ publishonly=False
2020
[KEYS]
2121
anon=627626823549f787c3ec763ff687169206626149
2222

23+
[DATABASES]
24+
# default settting
25+
path=./db.sqlite3
26+
# path=/Users/hadleyking/GitHub/biocompute-objects/dev/data/db.sqlite3
27+
2328
# Which host names do you want to associate with the server?
2429
# Note: the local hostname (i.e. 127.0.0.1) should come at the end.
2530
[HOSTNAMES]

docker-compose.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#cat docker-compose.yml
2+
3+
version: '3.4'
4+
5+
services:
6+
bco-api:
7+
build: .
8+
# image: ghcr.io/biocompute-objects/bco_api:latest
9+
container_name: bco-api
10+
environment:
11+
TZ: 'America/New_York'
12+
13+
ports:
14+
- "8000:8000"
15+
read_only: true
16+
tmpfs:
17+
- /tmp
18+
restart: unless-stopped
19+
stdin_open: true
20+
tty: true
21+
22+
# volumes:
23+
# - /Users/hadleyking/GitHub/biocompute-objects/dev/data/db.sqlite3:/biocompute_api/bco_api/db.sqlite3
24+
# - /Users/hadleyking/GitHub/biocompute-objects/dev/data/server.conf:/biocompute_api/bco_api/server.conf
25+

nohup.out

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)