Skip to content

Commit

Permalink
build(docker): create reana-client container image
Browse files Browse the repository at this point in the history
Closes #709
  • Loading branch information
tiborsimko committed Mar 14, 2024
1 parent 3bdf802 commit 382cb10
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is part of REANA.
# Copyright (C) 2017, 2018, 2020, 2021 CERN.
# Copyright (C) 2017, 2018, 2020, 2021, 2024 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -75,3 +75,6 @@ target/
# Docs autogeneration
cmd_list.txt
cli_api.md

# Bash history
.bash_history
48 changes: 48 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This file is part of REANA.
# Copyright (C) 2024 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

# Use Fedora 39
FROM registry.fedoraproject.org/fedora:38

# Install prerequisites
# hadolint ignore=DL3033,DL3041
RUN dnf install -y \
python3-click \
python3-jsonpointer \
python3-pathspec \
python3-pip \
python3-pulp \
python3-smart_open \
python3-swagger-spec-validator \
python3-tablib \
python3-tabulate \
python3-werkzeug \
python3-xrootd \
snakemake \
xrootd-client && \
dnf autoremove -y && \
dnf clean all && \
rm -rf /var/lib/apt/lists/*

# Add sources to `/code` and work there
WORKDIR /code
COPY . /code

# Install reana-client
# hadolint ignore=DL3013
RUN pip3 install --no-cache-dir '.[tests]' && \
rm -rf /code

# Run container as `reana` user with UID `1000`, which should match
# current host user in most situations
# hadolint ignore=DL3059
RUN adduser --uid 1000 reana --gid 0 && \
chown -R reana:root /home/reana
WORKDIR /home/reana

# Run reana-client upon entry
USER reana
ENTRYPOINT ["reana-client"]
18 changes: 18 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ check_cli_api () {
rm cli_api.md
}

check_dockerfile () {
docker run -i --rm docker.io/hadolint/hadolint:v2.12.0 < Dockerfile
}

check_docker_build () {
docker build -t docker.io/reanahub/reana-client .
}

check_docker_run () {
docker run --rm -v "$PWD"/tests:/home/reana/tests --entrypoint /bin/bash docker.io/reanahub/reana-client -c 'pytest tests'
}

check_sphinx () {
sphinx-build -qnNW docs docs/_build/html
sphinx-build -qnNW -b doctest docs docs/_build/doctest
Expand All @@ -82,6 +94,9 @@ check_all() {
check_manifest
check_cli_cmds
check_cli_api
check_dockerfile
check_docker_build
check_docker_run
check_sphinx
check_pytest
}
Expand All @@ -101,6 +116,9 @@ case $arg in
--check-manifest) check_manifest;;
--check-cli-cmds) check_cli_cmds;;
--check-cli-api) check_cli_api;;
--check-dockerfile) check_dockerfile;;
--check-docker-build) check_docker_build;;
--check-docker-run) check_docker_run;;
--check-sphinx) check_sphinx;;
--check-pytest) check_pytest;;
*) echo "[ERROR] Invalid argument '$arg'. Exiting." && exit 1;;
Expand Down

0 comments on commit 382cb10

Please sign in to comment.