-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker files for building python client
- Loading branch information
1 parent
6b70ceb
commit 4131860
Showing
3 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM ubuntu:focal as build | ||
|
||
ARG DATAFED_DIR="/datafed" | ||
ARG BUILD_DIR="/datafed/source" | ||
|
||
RUN mkdir -p ${BUILD_DIR} | ||
|
||
WORKDIR ${BUILD_DIR} | ||
|
||
COPY ./scripts/dependency_install_functions.sh ${BUILD_DIR}/scripts/ | ||
COPY ./scripts/dependency_versions.sh ${BUILD_DIR}/scripts/ | ||
COPY ./scripts/install_python_client_dependencies.sh ${BUILD_DIR}/scripts/ | ||
|
||
RUN echo "#!/bin/bash\n\$@" > /usr/bin/sudo && chmod +x /usr/bin/sudo | ||
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC ${BUILD_DIR}/scripts/install_python_client_dependencies.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
FROM code.ornl.gov:4567/dlsw/datafed/python-client-base:latest as build | ||
|
||
ARG DATAFED_DIR="/datafed" | ||
ARG BUILD_DIR="/datafed/source" | ||
ARG DATAFED_INSTALL_PATH="/datafed/install" | ||
|
||
# The above should also be available at runtime | ||
ENV DATAFED_DIR="$DATAFED_DIR" | ||
ENV BUILD_DIR="$BUILD_DIR" | ||
ENV DATAFED_INSTALL_PATH="$DATAFED_INSTALL_PATH/python-client" | ||
|
||
RUN mkdir -p ${BUILD_DIR}/logs | ||
RUN mkdir -p ${DATAFED_INSTALL_PATH} | ||
RUN mkdir -p ${DATAFED_INSTALL_PATH}/keys | ||
|
||
# For communicating with repo server | ||
# EXPOSE 7512 | ||
# For listening to web server | ||
# EXPOSE 7513 | ||
# ArangoDB port | ||
# EXPOSE 8529 | ||
|
||
# Create datafed user, prefer more secure login options than password | ||
# Recommended to mount ssh public key on run | ||
RUN adduser --disabled-password --gecos "" datafed | ||
|
||
WORKDIR ${BUILD_DIR} | ||
|
||
COPY ./common ${BUILD_DIR}/common | ||
COPY ./CMakeLists.txt ${BUILD_DIR} | ||
COPY ./scripts/dependency_versions.sh ${BUILD_DIR}/scripts/ | ||
COPY ./scripts/generate_datafed.sh ${BUILD_DIR}/scripts/ | ||
COPY ./cmake ${BUILD_DIR}/cmake | ||
COPY ./python ${BUILD_DIR}/python | ||
|
||
# All files should be owned by the datafed user | ||
RUN chown -R datafed:datafed ${DATAFED_DIR} | ||
|
||
USER datafed | ||
|
||
RUN ${BUILD_DIR}/scripts/generate_datafed.sh &&\ | ||
cmake -S. -B build -DBUILD_REPO_SERVER=False -DBUILD_AUTHZ=False \ | ||
-DBUILD_CORE_SERVER=False -DBUILD_WEB_SERVER=False \ | ||
-DBUILD_DOCS=False -DBUILD_PYTHON_CLIENT=True \ | ||
-DBUILD_FOXX=False -DENABLE_UNIT_TESTS=False \ | ||
-DBUILD_TESTS=False -DBUILD_COMMON=False &&\ | ||
cmake --build build -j 8 | ||
RUN cmake --build build --target pydatafed | ||
|
||
WORKDIR ${BUILD_DIR}/python/datafed_pkg | ||
|
||
# Install datafed client | ||
RUN python3 -m pip install . | ||
|
||
WORKDIR /home/datafed | ||
|
||
#ENTRYPOINT ["/bin/bash"] | ||
ENTRYPOINT ["/datafed/source/python/docker/entrypoint.sh"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
set -euf -o pipefail | ||
|
||
SCRIPT=$(realpath "$0") | ||
SOURCE=$(dirname "$SCRIPT") | ||
|
||
# Entry point file expects that the directory where the DataFed source file | ||
# is passed in as the first argument | ||
|
||
echo "SOURCE BUILD DIR $BUILD_DIR" | ||
|
||
# Here we will rerun datafed configuration script to create a new set of | ||
# default variables that are useful for setting up the DataFed Python client | ||
# ini file | ||
|
||
"${BUILD_DIR}/scripts/generate_datafed.sh" | ||
source "${BUILD_DIR}/config/datafed.sh" | ||
|
||
mkdir -p "/home/datafed/.datafed" | ||
|
||
# At this point we will create an ini file | ||
cat << EOF > "/home/datafed/.datafed/datafed-client.ini" | ||
[server] | ||
host = ${DATAFED_DOMAIN} | ||
port = ${DATAFED_SERVER_PORT} | ||
config_dir = /home/datafed/.datafed | ||
[client] | ||
config_dir = /home/datafed/.datafed | ||
EOF | ||
|
||
if [ "$#" -eq 0 ]; then | ||
echo "No arguments were passed, running bash" | ||
exec "/home/datafed/.local/bin/datafed --cfg /home/datafed/.datafed/datafed-client.ini" | ||
fi | ||
|
||
"$@" | ||
|