Skip to content

Commit 84b3373

Browse files
committed
Dockerizing (#199)
* Fix Bulk Publish function Changes to be committed: modified: api/scripts/method_specific/POST_api_objects_publish.py modified: api/scripts/utilities/JsonUtils.py * Changed for Dockerizing Changes to be committed: modified: Dockerfile modified: README.md modified: authentication/apis.py modified: search/selectors.py modified: server.conf * Update platform in `docker-compose.yml` * updates for FDA deployment Changes to be committed: modified: Dockerfile modified: docker-compose.yml
1 parent 07d0670 commit 84b3373

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

Dockerfile

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

5+
LABEL org.opencontainers.image.source=https://github.com/octocat/my-repo
6+
LABEL org.opencontainers.image.description="My container image"
7+
LABEL org.opencontainers.image.licenses=MIT
8+
59
# Note that this is just for debug / test purposes; should not be set via the setup for production
610
# ENV DJANGO_SUPERUSER_PASSWORD="BioCompute123"
711
# ENV DJANGO_SUPERUSER_USERNAME="BioComputeSuperUser"
@@ -17,12 +21,12 @@ COPY requirements.txt .
1721

1822
RUN python3 -m pip install -r requirements.txt
1923

20-
COPY bco_api ./bco_api
24+
COPY . ./
2125

22-
WORKDIR /biocompute_api/bco_api
26+
WORKDIR /biocompute_api/
2327

24-
RUN python3 manage.py migrate
25-
RUN python3 manage.py createsuperuser --no-input
28+
# RUN python3 manage.py migrate
29+
# RUN python3 manage.py createsuperuser --no-input
2630

2731
EXPOSE 8000
2832
#CMD ["bash"]

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,14 @@ This will build a container named `bco_api` with the tag `latest`.
6161

6262
### Running the container via Docker
6363

64-
The BCO Api container can be run via docker on the command line by running:
64+
The BCO Api container can be run via docker on the command line in linux by running:
6565

6666
`docker run --rm --network host -it bco_api:latest`
6767

68+
The BCO Api container can be run via docker on the command line in MacOS by running:
69+
70+
`docker run --rm -p 8000:8000 -it bco_api:latest`
71+
6872
This will expose the server at `http://127.0.0.1:8000`.
6973

7074
#### Overriding the port
@@ -73,6 +77,7 @@ It is possible to override the port 8000 to whatever port is desired. This is d
7377

7478
`docker run --rm --network host -it bco_api:latest 0.0.0.0:8080`
7579

80+
7681
NOTE: The ip address of 0.0.0.0 is to allow the web serer to properly associate with 127.0.0.1 - if given 127.0.0.1 it will not allow communications outside of the container!
7782

7883
With 8080 representing the desired port. You can also give it a specific network created with `docker network create` if you wanted to give assigned IP addresses.

authentication/apis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,12 @@ def post(self, request):
223223
""""""
224224

225225
result = validate_auth_service(request.data)
226+
226227
if result != 1:
227228
return Response(
228229
status=status.HTTP_403_FORBIDDEN,
229230
data=result
230231
)
231-
232232
try:
233233
auth_object = Authentication.objects.get(username=request.user.username)
234234
except Authentication.DoesNotExist:

docker-compose.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ version: '3.4'
44

55
services:
66
bco-api:
7+
platform: linux/amd64
78
build: .
8-
# image: ghcr.io/biocompute-objects/bco_api:latest
9+
image: ghcr.io/biocompute-objects/bco_api:23.07
910
container_name: bco-api
1011
volumes:
11-
- /Users/hadleyking/GitHub/biocompute-objects/dev/data/db.sqlite3:/biocompute_api/bco_api/db.sqlite3
12-
- /Users/hadleyking/GitHub/biocompute-objects/dev/data/server.conf:/biocompute_api/bco_api/server.conf
12+
- ./data/db.sqlite3:/biocompute_api/db.sqlite3
13+
- ./data/server.conf:/biocompute_api/server.conf
1314
environment:
1415
TZ: 'America/New_York'
1516
ENV DJANGO_SUPERUSER_PASSWORD: "BioCompute123"

search/selectors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def controled_list(user: User) -> QuerySet:
4545
raw_prefixes = UserUtils().prefix_perms_for_user(user_object=user)
4646
for prefix in raw_prefixes :
4747
pre = prefix.split("_")[1]
48-
if pre not in prefix_list and pre is not "prefix":
48+
if pre not in prefix_list and pre != "prefix":
4949
prefix_list.append(pre)
5050

5151
for prefix in prefix_list:

0 commit comments

Comments
 (0)