Skip to content

Commit 1672065

Browse files
committed
Dockerfiles has been added
1 parent 48cce91 commit 1672065

29 files changed

+208
-12
lines changed
Binary file not shown.

biocontainers/biomongo/helpers.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def insert_dockerhub_containers(dockerhub_containers):
139139
mongo_tool_version.name = container.name()
140140
mongo_tool_version.version = version
141141
mongo_tool_version.description = container.description()
142-
mongo_tool_version.tool_classes = ['TOOL']
142+
mongo_tool_version.tool_classes = [_CONSTANT_TOOL_CLASSES['CommandLineTool']]
143143
mongo_tool_version.id = tool_version_id
144144
else:
145145
mongo_tool_version = tool_versions_dic[tool_version_id]
@@ -166,7 +166,9 @@ def insert_dockerhub_containers(dockerhub_containers):
166166
mongo_tool.name = container.name()
167167
mongo_tool.id = container.name()
168168
mongo_tool.description = container.description()
169+
mongo_tool.tool_classes = [_CONSTANT_TOOL_CLASSES['CommandLineTool']]
169170
tools_dic[tool_id] = mongo_tool
171+
170172
else:
171173
mongo_tool = tools_dic[tool_id]
172174

Binary file not shown.
Binary file not shown.

biocontainers/dockerhub/models.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def get_list_containers(self):
7676
for key in json_data['results']:
7777
container = DockerHubContainer(key)
7878
self.container_list.append(container)
79-
print(container.name())
79+
logger.info(" Current tool has been retrieve from DockerHub -- " + container.name())
8080
string_url = json_data['next']
8181

8282
return self.container_list
@@ -109,9 +109,9 @@ def get_containers(self, page=None, batch=None):
109109
short_container.add_all_tags(json_data['results'])
110110
container = short_container
111111
containers_list.append(container)
112-
print(container.name())
112+
logger.info(" Current tool has been retrieve from DockerHub -- " + container.name())
113113
except ConnectionError:
114-
logger.error("Connection has failed to DockerHub for container ID --" + container.id)
114+
logger.error(" Connection has failed to DockerHub for container ID --" + container.id)
115115

116116
self.container_list = containers_list
117117
return self.container_list

biocontainers/pipelines.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import argparse
12
import configparser
23
import logging
34

@@ -51,7 +52,7 @@ def import_dockerhub_containers(config, config_profile):
5152
reader.dockerhub_list_url(config[config_profile]['DOCKER_HUB'])
5253
reader.dockerhub_tags_url(config[config_profile]['DOCKER_HUB_TAG'])
5354
reader.namespace(config[config_profile]['NAMESPACE'])
54-
dockerhub_containers = reader.get_containers(batch=200)
55+
dockerhub_containers = reader.get_containers()
5556

5657
mongo_helper = InsertContainers(config[config_profile]['DATABASE_URI'])
5758
mongo_helper.insert_dockerhub_containers(dockerhub_containers)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

biocontainers_flask/server/controllers/ga4_gh_controller.py

+17-7
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def tools_id_versions_get(id): # noqa: E501
118118
for mongo_tool_version in mongo_tool_versions:
119119
tool_versions.append(transform_tool_version(mongo_tool_version, mongo_tool.id))
120120

121-
122121
return tool_versions
123122

124123

@@ -134,7 +133,7 @@ def tools_id_versions_version_id_containerfile_get(id, version_id): # noqa: E50
134133
135134
:rtype: List[FileWrapper]
136135
"""
137-
return 'do some magic!'
136+
return 'No yet implemented!'
138137

139138

140139
def tools_id_versions_version_id_get(id, version_id): # noqa: E501
@@ -149,7 +148,18 @@ def tools_id_versions_version_id_get(id, version_id): # noqa: E501
149148
150149
:rtype: ToolVersion
151150
"""
152-
return 'do some magic!'
151+
mongo_tool = MongoTool.get_tool_by_id(id)
152+
tool_versions = []
153+
if mongo_tool is not None:
154+
mongo_tool_versions = mongo_tool.get_tool_versions()
155+
for mongo_tool_version in mongo_tool_versions:
156+
tool_versions.append(transform_tool_version(mongo_tool_version, mongo_tool.id))
157+
158+
for tool_version in tool_versions:
159+
if tool_version.id == version_id:
160+
return tool_version
161+
162+
return None
153163

154164

155165
def tools_id_versions_version_id_type_descriptor_get(type, id, version_id): # noqa: E501
@@ -166,7 +176,7 @@ def tools_id_versions_version_id_type_descriptor_get(type, id, version_id): # n
166176
167177
:rtype: FileWrapper
168178
"""
169-
return 'do some magic!'
179+
return 'Not yet Implemented!'
170180

171181

172182
def tools_id_versions_version_id_type_descriptor_relative_path_get(type, id, version_id, relative_path): # noqa: E501
@@ -185,7 +195,7 @@ def tools_id_versions_version_id_type_descriptor_relative_path_get(type, id, ver
185195
186196
:rtype: FileWrapper
187197
"""
188-
return 'do some magic!'
198+
return 'Not yet implemented!'
189199

190200

191201
def tools_id_versions_version_id_type_files_get(type, id, version_id): # noqa: E501
@@ -202,7 +212,7 @@ def tools_id_versions_version_id_type_files_get(type, id, version_id): # noqa:
202212
203213
:rtype: List[ToolFile]
204214
"""
205-
return 'do some magic!'
215+
return 'Not Yet Implemented'
206216

207217

208218
def tools_id_versions_version_id_type_tests_get(type, id, version_id): # noqa: E501
@@ -219,4 +229,4 @@ def tools_id_versions_version_id_type_tests_get(type, id, version_id): # noqa:
219229
220230
:rtype: List[FileWrapper]
221231
"""
222-
return 'do some magic!'
232+
return 'Not Yet Implemented'
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

dockerfiles/mongo-init/Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM mongo:3.6
2+
3+
ADD first_run.sh /first_run.sh
4+
5+
ENTRYPOINT ["bash", "/first_run.sh"]

dockerfiles/mongo-init/first_run.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# Create User
4+
echo "Creating user: \"$USER\"..."
5+
mongo --host $MONGODB_HOST --username $ADMIN_USER --password $ADMIN_PASSWORD --eval "db.createUser({ user: '$MONGODB_USER', pwd: '$MONGODB_PASS', roles: [ { role: '$MONGODB_ROLES', db: '$MONGO_DB' } ] });"
6+
7+
8+
echo "========================================================================"
9+
echo "MongoDB User: \"$USER\""
10+
echo "MongoDB Password: \"$PASS\""
11+
echo "MongoDB Database: \"$DB\""
12+
echo "MongoDB Role: \"$ROLE\""
13+
echo "========================================================================"

dockerfiles/pipelines/Dockerfile

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
################## BASE IMAGE ######################
3+
4+
FROM python:2.7.15-alpine3.6
5+
6+
################## METADATA ######################
7+
8+
LABEL base_image="python:2.7.15-alpine3.6"
9+
LABEL version="1"
10+
LABEL software="biocontainers-pipelines-py"
11+
LABEL software.version="1.0.0"
12+
LABEL about.summary="The pipelines retrieve all the biocontainers sources dockerhub, quay.io and other resources"
13+
LABEL about.home="https://biocontainers.pro"
14+
LABEL about.license="SPDX:Apache-2"
15+
16+
################## MAINTAINER ######################
17+
18+
MAINTAINER Yasset Perez-Riverol <[email protected]>
19+
20+
################## INSTALLATION ######################
21+
22+
RUN apk update && apk add wget git python
23+
RUN git clone --single-branch -b master https://github.com/BioContainers/biocontainers-backend.git
24+
RUN cd /biocontainers-backend && python pip -r requirements.txt
25+
26+
FROM openjdk:8-jre-stretch
27+
28+
RUN echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list
29+
RUN apt-get update && apt-get install -y --allow-unauthenticated mongodb-org-shell
30+
31+
COPY --from=0 /registry-backend/registry-pipelines/target/registry-pipelines-1.0-SNAPSHOT.jar /registry-pipelines.jar
32+
33+

dockerfiles/pipelines/run.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
java -jar /registry-pipelines.jar --mongodb.biocontainers.db.database=$BIOCONT_DB_NAME \
4+
--mongodb.biocontainers.db.user=$MONGODB_USER \
5+
--mongodb.biocontainers.db.password=$MONGODB_PASS \
6+
--mongodb.biocontainers.db.authenticationDatabase=$MONGODB_ADMIN_DB \
7+
--mongodb.biocontainers.db.host=$MONGODB_HOST \
8+
--mongodb.biocontainers.db.port=27017
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
To test on minikube:
2+
3+
```
4+
minikube start
5+
helm init --wait
6+
helm install -f ../../helm-example-configs/minikube.yaml ../../biocontainer-registry
7+
```
8+
9+
Then check pods and if failing, see the logs:
10+
11+
```
12+
kubectl get pods
13+
# check for pod name
14+
kubectl logs -f <pod-name>
15+
```
16+
17+
To make changes on the container:
18+
19+
```
20+
# point docker engine to minikubes to avoid building and pushing to dockerhub between tests:
21+
eval $(minikube docker-env)
22+
# with this user you won't need to change the minikube yaml config, but change it if you want to push
23+
docker build -t pcm32/biocontainers-api:8-stretch .
24+
# Delete the pod (change pod name below)
25+
kubectl delete pods/<pod-name>
26+
# Get logs from new pod, after looking into `kubectl get pods`
27+
```

dockerfiles/service/Dockerfile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
################## BASE IMAGE ######################
3+
4+
FROM openjdk:8-jdk-alpine
5+
6+
################## METADATA ######################
7+
8+
LABEL base_image="biocontainers:debian-stretch-backports"
9+
LABEL version="1"
10+
LABEL software="biocontainers-api-py"
11+
LABEL software.version="1.0.0"
12+
LABEL about.summary="The biocontainers API provides an entry point to retrieve all containers"
13+
LABEL about.home="https://biocontainers.pro"
14+
LABEL about.license="SPDX:Apache-2"
15+
16+
################## MAINTAINER ######################
17+
18+
MAINTAINER Yasset Perez-Riverol <[email protected]>
19+
20+
################## INSTALLATION ######################
21+
22+
RUN apk update && apk add maven wget git
23+
RUN git clone --single-branch -b master https://github.com/BioContainers/registry-backend.git
24+
RUN cd /registry-backend && mvn install -DskipTests
25+
26+
FROM openjdk:8-jre-stretch
27+
28+
RUN echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list
29+
RUN apt-get update && apt-get install -y --allow-unauthenticated mongodb-org-shell
30+
31+
COPY --from=0 /registry-backend/biocontainers-api/target/biocontainers-api-1.0-SNAPSHOT.jar /api-service.jar
32+
33+
ADD run.sh /usr/local/bin/run.sh
34+
RUN chmod u+x /usr/local/bin/run.sh
35+
ENTRYPOINT ["run.sh"]

dockerfiles/service/run.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
# --mongodb.biocontainers.db.authenticationDatabase= \
4+
# --mongodb.biocontainers.db.port= \
5+
6+
cat > mongo_exec.js <<- EOM
7+
db = db.getSiblingDB('admin');
8+
try {
9+
db.createUser({ user: "$MONGODB_USER" , pwd: "$MONGODB_PASS", roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"] });
10+
} catch(err) {
11+
print("Could not create user: "+err.message )
12+
print("Trying to add role to existing user")
13+
db.grantRolesToUser( "$MONGODB_USER", ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"] );
14+
}
15+
/* uncomment for debugging
16+
printjson( db.getUser( "$MONGODB_USER", {
17+
showCredentials: false,
18+
showPrivileges: true,
19+
showAuthenticationRestrictions: true
20+
} ) )
21+
*/
22+
EOM
23+
24+
cat mongo_exec.js
25+
26+
27+
mongo --host $MONGODB_HOST -u root -p $MONGO_ROOT_PASS --authenticationDatabase \
28+
$MONGODB_ADMIN_DB mongo_exec.js
29+
30+
java -jar /api-service.jar --mongodb.biocontainers.db.database=$BIOCONT_DB_NAME \
31+
--mongodb.biocontainers.db.user=$MONGODB_USER \
32+
--mongodb.biocontainers.db.password=$MONGODB_PASS \
33+
--mongodb.biocontainers.db.authenticationDatabase=$MONGODB_ADMIN_DB \
34+
--mongodb.biocontainers.db.host=$MONGODB_HOST \
35+
--mongodb.biocontainers.db.port=27017
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
To test on minikube:
2+
3+
```
4+
minikube start
5+
helm init --wait
6+
helm install -f ../../helm-example-configs/minikube.yaml ../../biocontainer-registry
7+
```
8+
9+
Then check pods and if failing, see the logs:
10+
11+
```
12+
kubectl get pods
13+
# check for pod name
14+
kubectl logs -f <pod-name>
15+
```
16+
17+
To make changes on the container:
18+
19+
```
20+
# point docker engine to minikubes to avoid building and pushing to dockerhub between tests:
21+
eval $(minikube docker-env)
22+
# with this user you won't need to change the minikube yaml config, but change it if you want to push
23+
docker build -t pcm32/biocontainers-api:8-stretch .
24+
# Delete the pod (change pod name below)
25+
kubectl delete pods/<pod-name>
26+
# Get logs from new pod, after looking into `kubectl get pods`
27+
```

0 commit comments

Comments
 (0)