Skip to content

Commit 7afb9c4

Browse files
committed
Moved the docker files to their own folder
Allow to specify location of the static content in the web server
1 parent 3bdf799 commit 7afb9c4

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

Dockerfile Docker/Dockerfile

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@ RUN apt-get update && \
99
rm -rf /var/lib/apt/lists/*
1010

1111
RUN pip install bottle pandas
12+
RUN git clone https://github.com/gilestrolab/ethoscope_metadata_db.git /opt/ethoscope_metadata_db
1213

13-
WORKDIR /opt
14-
RUN git clone https://github.com/gilestrolab/ethoscope_metadata_db.git
14+
WORKDIR /opt/ethoscope_metadata_db
1515
RUN pip install -e .
1616

17-
WORKDIR /opt/ethoscope_metadata_db
1817
CMD ["python", "/opt/ethoscope_metadata_db/ethoscope_metadata_db/metadata_db_server.py", "--refresh", "--metadata", "/opt/ethoscope_metadata"]
1918

20-
21-
# sudo docker run -d -p 8081:8081 \
19+
# Build and run with
20+
#
21+
# docker build -t ethoscope_metadata_server-lab.gilest.ro . --no-cache
22+
#
23+
# docker run -d -p 8081:8081 \
2224
# --name ethoscope-metadata-server \
2325
# --volume /mnt/data/results:/mnt/ethoscope_results:ro \
2426
# --volume /mnt/data/ethoscope_metadata:/opt/ethoscope_metadata \

Docker/docker-compose.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '3.8'
2+
3+
services:
4+
ethoscope-metadata-server:
5+
container_name: ethoscope-metadata-server
6+
image: ethoscope_metadata_server-lab.gilest.ro
7+
volumes:
8+
- /mnt/data/results:/mnt/ethoscope_results:ro
9+
- /mnt/data/ethoscope_metadata:/opt/ethoscope_metadata
10+
ports:
11+
- "8081:8081"
12+
environment:
13+
VIRTUAL_HOST: "metadata.lab.gilest.ro"
14+
VIRTUAL_PORT: "8081"
15+
LETSENCRYPT_HOST: "metadata.lab.gilest.ro"
16+
LETSENCRYPT_EMAIL: "giorgio@gilest.ro"
17+
restart: unless-stopped
18+
networks:
19+
name: nginx-proxy
20+
external: True

ethoscope_metadata_db/metadata_db_server.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
from metadata_db import db_organiser, metadata_handler, metadata_crawler
3737

3838
app = bottle.Bottle()
39-
STATIC_DIR = "./static"
4039

4140
@app.route('/static/<filepath:path>')
4241
def server_static(filepath):
@@ -165,6 +164,7 @@ def close(exit_status=0):
165164
parser = optparse.OptionParser()
166165
parser.add_option("-d", "--db", dest="db_path", default="/mnt/ethoscope_results", help="Path to the root of the ethoscope db files")
167166
parser.add_option("-m", "--metadata", dest="md_path", default="/opt/ethoscope_metadata", help="Path to the root of the metadata files")
167+
parser.add_option("--static", dest="static_path", default="/opt/ethoscope_metadata_db/ethoscope_metadata_db", help="Path to the root of the static folder")
168168
parser.add_option("-r", "--refresh", dest="refresh_db", default=False, help="Refresh ethoscope database on start", action="store_true")
169169

170170
parser.add_option("-D", "--debug", dest="debug", default=False, help="Set DEBUG mode ON", action="store_true")
@@ -173,6 +173,7 @@ def close(exit_status=0):
173173
(options, args) = parser.parse_args()
174174

175175
option_dict = vars(options)
176+
STATIC_DIR = os.path.join(option_dict["static_path"], "./static")
176177
DB_PATH = option_dict["db_path"]
177178
MD_PATH = option_dict["md_path"]
178179
REFRESH_DB = option_dict["refresh_db"]

0 commit comments

Comments
 (0)