Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
FROM ubuntu:20.04

MAINTAINER Fernando Aguilar "[email protected]"
FROM python:3.11-slim AS base

RUN apt-get update -y && \
apt-get install -y curl python3-pip python3-dev git vim lsof

RUN git clone https://github.com/ifca-advanced-computing/FAIR_eva.git

COPY . /FAIR_eva
WORKDIR /FAIR_eva

RUN chmod +x scripts/entrypoint.sh
RUN pip3 install git+https://github.com/IFCA-Advanced-Computing/fair-eva-plugin-oai-pmh
RUN pip3 install -r requirements.txt
RUN pip3 install .

ARG FAIR_EVA_HOST=0.0.0.0
ARG FAIR_EVA_PORT=9090
ARG START_CMD="fair-eva"

ENV FAIR_EVA_HOST=${FAIR_EVA_HOST} \
FAIR_EVA_PORT=${FAIR_EVA_PORT} \
START_CMD=${START_CMD}

EXPOSE 5000 9090
RUN ls
RUN mv /FAIR_eva/config.ini.template /FAIR_eva/config.ini
RUN cd /FAIR_eva
RUN chmod 777 start.sh
RUN cat start.sh
CMD /FAIR_eva/start.sh
EXPOSE ${FAIR_EVA_PORT}
ENTRYPOINT ["/FAIR_eva/scripts/entrypoint.sh"]
10 changes: 9 additions & 1 deletion fair_eva/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
def set_parser():
parser = argparse.ArgumentParser(description="FAIR EVA API server")

parser.add_argument(
"--host",
type=str,
metavar="HOST",
dest="host",
default="127.0.0.1",
help="Host IP where API server will run (default: 127.0.0.1)",
)
parser.add_argument(
"-p",
"--port",
Expand All @@ -31,4 +39,4 @@ def main():
arguments={"title": "FAIR evaluator"},
resolver=RestyResolver("fair_eva.api"),
)
app.run(port=options_cli.port)
app.run(host=options_cli.host, port=options_cli.port)
16 changes: 16 additions & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Entrypoint script for FAIR_eva Docker container
# This script handles environment variables and launches the fair-eva application

# Set default values for environment variables
FAIR_EVA_HOST=${FAIR_EVA_HOST:-0.0.0.0}
FAIR_EVA_PORT=${FAIR_EVA_PORT:-9090}
START_CMD=${START_CMD:-fair-eva}

# Build the command to run fair-eva
CMD="$START_CMD --host $FAIR_EVA_HOST --port $FAIR_EVA_PORT"

# Execute the command
echo "Starting FAIR_eva with command: $CMD"
exec $CMD