Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joshua s brown feature add dev compose #912

Closed
wants to merge 76 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
ac0a450
First steps for setting up docker compose file
JoshuaSBrown Oct 18, 2023
da66d18
Initial commit for compose build
JoshuaSBrown Oct 18, 2023
a19a9f9
Create build for python client
JoshuaSBrown Oct 18, 2023
73c3a98
Add default to DATAFED_SERVER_PORT
JoshuaSBrown Oct 18, 2023
6b70ceb
Add script for installing dependencies for building the python client
JoshuaSBrown Oct 18, 2023
4131860
Add docker files for building python client
JoshuaSBrown Oct 18, 2023
57f1396
Applied formatting
JoshuaSBrown Oct 18, 2023
6309dfa
Merge branch 'JoshuaSBrown-fix-ci-part2' into JoshuaSBrown-feature-ad…
JoshuaSBrown Oct 18, 2023
2d35350
Add changelog command
JoshuaSBrown Oct 18, 2023
b0ea242
Address CHANGELOG conflict
JoshuaSBrown Oct 18, 2023
1753808
fix build images script
JoshuaSBrown Dec 4, 2023
bd997c1
Address merge conflict"
JoshuaSBrown Feb 6, 2024
cd5feeb
Fix dockerfiles
JoshuaSBrown Feb 6, 2024
af6c665
addressing differences
JoshuaSBrown Feb 7, 2024
3182e39
Merge branch 'JoshuaSBrown-fix-ci-with-new-docker-images' into Joshua…
JoshuaSBrown Feb 9, 2024
21d604b
Add CHangelog comment
JoshuaSBrown Feb 9, 2024
ae89d73
Add missing env files
JoshuaSBrown Feb 9, 2024
a933cf7
Debug
JoshuaSBrown Feb 10, 2024
05280c3
Merge branch 'devel' into JoshuaSBrown-debug-container-run
JoshuaSBrown Feb 10, 2024
6df9184
Make image customizable
JoshuaSBrown Feb 11, 2024
f494f54
Fix web build and env variables
JoshuaSBrown Feb 11, 2024
81c0a27
Make core build customizable
JoshuaSBrown Feb 11, 2024
c60c64f
Sleep for 10 seconds before checking if container is still running
JoshuaSBrown Feb 11, 2024
8882c11
Run as deamon
JoshuaSBrown Feb 11, 2024
8448c90
Save run script
JoshuaSBrown Feb 12, 2024
db16621
Remove comments
JoshuaSBrown Feb 12, 2024
68c5919
Add missing EOF
JoshuaSBrown Feb 12, 2024
a6eb53f
minor fixes
JoshuaSBrown Feb 12, 2024
7c9372f
Add missing here doc
JoshuaSBrown Feb 12, 2024
ab7f4ce
Try to limit the number of times a build happens
JoshuaSBrown Feb 13, 2024
fa378af
Remove tabs
JoshuaSBrown Feb 13, 2024
dce32ea
Multiline yml command
JoshuaSBrown Feb 13, 2024
1dd933f
Fix missing stage
JoshuaSBrown Feb 13, 2024
377d98a
Address new globus connect server tag
JoshuaSBrown Feb 13, 2024
0c3c55d
Remove heredoc in favor of echo
JoshuaSBrown Feb 13, 2024
5d61f28
Fix gitlab
JoshuaSBrown Feb 13, 2024
811c1ad
Temporarily turn off build
JoshuaSBrown Feb 13, 2024
b0d2a2c
comment out stage
JoshuaSBrown Feb 13, 2024
dfb854e
Fix stage
JoshuaSBrown Feb 13, 2024
483f5ce
Hopefully fix log file path
JoshuaSBrown Feb 13, 2024
58daf00
Fix permissions
JoshuaSBrown Feb 13, 2024
8626e7e
Correct install path hopefully
JoshuaSBrown Feb 14, 2024
bafd4fd
Fix ci variables
JoshuaSBrown Feb 14, 2024
ae33e19
Fix permissions
JoshuaSBrown Feb 14, 2024
37475e8
Debugging volume mounts
JoshuaSBrown Feb 14, 2024
9e059fe
Try to fix user id troubles with volume mounts
JoshuaSBrown Feb 14, 2024
f5817b3
Changes to how entrypoint handles arguments
JoshuaSBrown Feb 14, 2024
1c0cffa
End image build as root user
JoshuaSBrown Feb 14, 2024
5e352a7
Change user permissions
JoshuaSBrown Feb 14, 2024
428caa3
Moving towards working compose file
JoshuaSBrown Feb 14, 2024
569cc50
Address merge conflict
JoshuaSBrown Feb 14, 2024
edb3436
Working dev version of web server
JoshuaSBrown Feb 16, 2024
a13e386
Fix stage
JoshuaSBrown Feb 16, 2024
e19f172
Fix ci file
JoshuaSBrown Feb 16, 2024
78d9f2f
Fix path
JoshuaSBrown Feb 16, 2024
e12d40a
Comment out python client
JoshuaSBrown Feb 16, 2024
b9c2a59
Update images
JoshuaSBrown Feb 16, 2024
6e6bb50
Address codacy issues
JoshuaSBrown Feb 19, 2024
73dac5b
A few small fixes
JoshuaSBrown Feb 19, 2024
2484b46
Small fixes to get Globus working with DataFed compose
JoshuaSBrown Feb 19, 2024
2c2480d
Cleanup a little
JoshuaSBrown Feb 19, 2024
959bcb9
Small changes
JoshuaSBrown Feb 19, 2024
005b707
add comment
JoshuaSBrown Feb 19, 2024
cf2daf6
Add check for database connection
JoshuaSBrown Feb 19, 2024
f306305
Fix CI pipeline health check script
JoshuaSBrown Feb 19, 2024
29b626d
Fix order
JoshuaSBrown Feb 19, 2024
86684d3
Fix core
JoshuaSBrown Feb 19, 2024
57d490f
Fix ci script
JoshuaSBrown Feb 19, 2024
25c8236
Switch to double ==
JoshuaSBrown Feb 19, 2024
1f300b4
Change piped tee command owner
JoshuaSBrown Feb 19, 2024
34695d5
Fix output tee command ownership
JoshuaSBrown Feb 19, 2024
f5546a1
Fix == and variables that were missing $
JoshuaSBrown Feb 19, 2024
4a2ae48
Make sure web server gets core key
JoshuaSBrown Feb 19, 2024
37e637c
Fix web path
JoshuaSBrown Feb 19, 2024
6161576
A few small fixes
JoshuaSBrown Feb 19, 2024
bea7d32
Merge branch 'JoshuaSBrown-debug-container-run' into JoshuaSBrown-fea…
JoshuaSBrown Feb 19, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/.idea/
build
common/proto/common/Version.proto
compose/.env
config/datafed.sh
config/datafed-authz.cfg
config/datafed-core.cfg
Expand Down
282 changes: 196 additions & 86 deletions .gitlab-ci.yml

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
## MAJOR Breaking changes

## MINOR Feature
1. [909] - Added Support for Google Analytics
2. [916] - Reworked Docker build process to be faster and produce simpler and smaller images
1. [912] - Adds initial compose file and docker files for python-client
2. [909] - Added Support for Google Analytics
3. [916] - Reworked Docker build process to be faster and produce simpler and smaller images
4. [912] - Adding working compose instance for core metadata services.

## PATCH Bug fixes/Technical Debt/Documentation
1. [914] - Improve GitHub template
Expand Down
33 changes: 33 additions & 0 deletions compose/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Compose Dev environment

The files in this folder are incomplete but are the start for setting up a full
docker compose instance of datafed.

```bash
./build_images_for_compose.sh
```

Create the .env file fill in the missing components that are required.
```bash
./generate_env.sh
```

Stand up the core services.
```bash
docker compose -f ./compose_core.yml up
```

At this point you should be able to navigate in your browser to
https://localhost

NOTE we are using a self signed certificate so you will have to force your
browser to allow you to see the page.

Standing up the repo services has been separated because of Globus. You will
need a machine with firewall exceptions to use it.

## Cleaning up

```bash
docker compose -f ./compose_core.yml down
```
41 changes: 41 additions & 0 deletions compose/build_images_for_compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

set -euf -o pipefail

SCRIPT=$(realpath "$0")
SOURCE=$(dirname "$SCRIPT")
PROJECT_ROOT=$(realpath "${SOURCE}/../")

docker build \
-f "${PROJECT_ROOT}/docker/Dockerfile.dependencies" \
"${PROJECT_ROOT}" \
-t datafed-dependencies:latest
docker build \
-f "${PROJECT_ROOT}/docker/Dockerfile.runtime" \
"${PROJECT_ROOT}" \
-t datafed-runtime:latest
docker build -f \
"${PROJECT_ROOT}/core/docker/Dockerfile" \
--build-arg DEPENDENCIES="datafed-dependencies" \
--build-arg RUNTIME="datafed-runtime" \
"${PROJECT_ROOT}" \
-t datafed-core:latest
docker build -f \
"${PROJECT_ROOT}/web/docker/Dockerfile" \
--build-arg DEPENDENCIES="datafed-dependencies" \
--build-arg RUNTIME="datafed-runtime" \
"${PROJECT_ROOT}" \
-t datafed-web:latest
docker build -f \
"${PROJECT_ROOT}/repository/docker/Dockerfile" \
--build-arg DEPENDENCIES="datafed-dependencies" \
--build-arg RUNTIME="datafed-runtime" \
"${PROJECT_ROOT}" \
-t datafed-repo:latest
docker build -f \
"${PROJECT_ROOT}/docker/Dockerfile.foxx" \
--build-arg DEPENDENCIES="datafed-dependencies" \
--build-arg RUNTIME="datafed-runtime" \
"${PROJECT_ROOT}" \
-t datafed-foxx:latest

91 changes: 91 additions & 0 deletions compose/compose_core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
version: '3.9'


services:

datafed-web:
depends_on: ["datafed-core"]
environment:
DATAFED_GLOBUS_APP_SECRET: "${DATAFED_GLOBUS_APP_SECRET}"
DATAFED_GLOBUS_APP_ID: "${DATAFED_GLOBUS_APP_ID}"
DATAFED_ZEROMQ_SESSION_SECRET: "${DATAFED_ZEROMQ_SESSION_SECRET}"
DATAFED_ZEROMQ_SYSTEM_SECRET: "${DATAFED_ZEROMQ_SYSTEM_SECRET}"
DATAFED_DOMAIN: "${DATAFED_DOMAIN}"
DATAFED_HTTPS_SERVER_PORT: "${DATAFED_HTTPS_SERVER_PORT}"
DATAFED_WEB_CERT_PATH: "${DATAFED_WEB_CERT_PATH}"
DATAFED_WEB_KEY_PATH: "${DATAFED_WEB_KEY_PATH}"
DATAFED_DEFAULT_LOG_PATH: "${DATAFED_CONTAINER_LOG_PATH}"
DATAFED_CORE_ADDRESS_PORT_INTERNAL: "datafed-core:7513"
UID: "${DATAFED_UID}"
image: datafed-web:latest
ports:
- 443:443 # This must be the same port that is mapped to the host for redirects to work
volumes:
- ./keys:/opt/datafed/keys
networks:
- datafed-internal

datafed-core:
image: datafed-core:latest
depends_on:
datafed-foxx:
condition: service_healthy
environment:
DATAFED_GLOBUS_APP_SECRET: "${DATAFED_GLOBUS_APP_SECRET}"
DATAFED_GLOBUS_APP_ID: "${DATAFED_GLOBUS_APP_ID}"
DATAFED_ZEROMQ_SESSION_SECRET: "${DATAFED_ZEROMQ_SESSION_SECRET}"
DATAFED_ZEROMQ_SYSTEM_SECRET: "${DATAFED_ZEROMQ_SYSTEM_SECRET}"
DATAFED_DOMAIN: "${DATAFED_DOMAIN}"
DATAFED_WEB_CERT_PATH: "${DATAFED_WEB_CERT_PATH}"
DATAFED_WEB_KEY_PATH: "${DATAFED_WEB_KEY_PATH}"
DATAFED_DEFAULT_LOG_PATH: "${DATAFED_CONTAINER_LOG_PATH}"
UID: "${DATAFED_UID}"
DATAFED_DATABASE_PASSWORD: "${DATAFED_DATABASE_PASSWORD}"
DATAFED_DATABASE_IP_ADDRESS: "${DATAFED_DATABASE_IP_ADDRESS}"
DATAFED_DATABASE_IP_ADDRESS_PORT: "${DATAFED_DATABASE_IP_ADDRESS}:${DATAFED_DATABASE_PORT}"
ports:
- 7513 # Communication web server
- 7512 # Secure core server communication
volumes:
- ./keys:/opt/datafed/keys
networks:
- datafed-core-secure-api
- datafed-internal

datafed-foxx:
image: datafed-foxx:latest
depends_on: ["arango"]
environment:
DATAFED_ZEROMQ_SYSTEM_SECRET: "${DATAFED_ZEROMQ_SYSTEM_SECRET}"
DATAFED_DOMAIN: "${DATAFED_DOMAIN}"
DATAFED_DEFAULT_LOG_PATH: "${DATAFED_CONTAINER_LOG_PATH}"
UID: "${DATAFED_UID}"
DATAFED_DATABASE_PASSWORD: "${DATAFED_DATABASE_PASSWORD}"
DATAFED_DATABASE_IP_ADDRESS: "${DATAFED_DATABASE_IP_ADDRESS}"
DATAFED_DATABASE_HOST: "arango"
healthcheck:
test: ["CMD", "/bin/bash", "-c", "[ -f /tmp/.foxx_is_installed ]"]
interval: 10s
timeout: 5s
retries: 10
networks:
- datafed-internal

arango:
image: arangodb
environment:
ARANGO_ROOT_PASSWORD: "${DATAFED_DATABASE_PASSWORD}"
ports:
- 8529:8529 # Arangodb web UI
networks:
- datafed-internal

volumes:
keys:

networks:
datafed-core-secure-api:
driver: bridge
datafed-internal:
driver: bridge

141 changes: 141 additions & 0 deletions compose/generate_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#!/bin/bash
SCRIPT=$(realpath "$0")
SOURCE=$(dirname "$SCRIPT")
PROJECT_ROOT=$(realpath "${SOURCE}/..")

if [ -f ".env" ]
then
echo ".env already exist! Will not overwrite!"
exit 1
fi

local_DATAFED_WEB_KEY_DIR="${PROJECT_ROOT}/compose/keys"
if [ ! -d "$local_DATAFED_WEB_KEY_DIR" ]
then
mkdir -p "$local_DATAFED_WEB_KEY_DIR"
fi

if [ -z "${DATAFED_COMPOSE_DOMAIN}" ]
then
local_DATAFED_COMPOSE_DOMAIN="localhost"
else
local_DATAFED_COMPOSE_DOMAIN=$(printenv DATAFED_COMPOSE_DOMAIN)
fi

local_DATAFED_WEB_CERT_NAME="cert.crt"
local_DATAFED_WEB_KEY_NAME="cert.key"

local_DATAFED_WEB_CERT_PATH="${local_DATAFED_WEB_KEY_DIR}/${local_DATAFED_WEB_CERT_NAME}"
local_DATAFED_WEB_CSR_PATH="${local_DATAFED_WEB_KEY_DIR}/cert.csr"
local_DATAFED_WEB_KEY_PATH="${local_DATAFED_WEB_KEY_DIR}/${local_DATAFED_WEB_KEY_NAME}"

if [ ! -e "$local_DATAFED_WEB_CERT_PATH" ] || [ ! -e "$local_DATAFED_WEB_KEY_PATH" ]
then
if [ -e "$local_DATAFED_WEB_CERT_PATH" ]
then
rm "${local_DATAFED_WEB_CERT_PATH}"
fi
if [ -e "$local_DATAFED_WEB_KEY_PATH" ]
then
rm "${local_DATAFED_WEB_KEY_PATH}"
fi
if [ -e "$local_DATAFED_WEB_CSR_PATH" ]
then
rm "${local_DATAFED_WEB_CSR_PATH}"
fi
openssl genrsa -out "$local_DATAFED_WEB_KEY_PATH" 2048
openssl req -new -key "$local_DATAFED_WEB_KEY_PATH" \
-out "${local_DATAFED_WEB_CSR_PATH}" \
-subj "/C=US/ST=TN/L=Oak Ridge/O=ORNL/OU=DLT/CN=${local_DATAFED_COMPOSE_DOMAIN}"
openssl x509 -req -days 3650 \
-in "${local_DATAFED_WEB_CSR_PATH}" \
-signkey "$local_DATAFED_WEB_KEY_PATH" \
-out "$local_DATAFED_WEB_CERT_PATH"
fi

if [ -z "${DATAFED_COMPOSE_USER89_PASSWORD}" ]
then
local_DATAFED_COMPOSE_USER89_PASSWORD="" # For End to end testing
else
local_DATAFED_COMPOSE_USER89_PASSWORD=$(printenv DATAFED_COMPOSE_USER89_PASSWORD)
fi
if [ -z "${DATAFED_COMPOSE_REPO_FORM_PATH}" ]
then
local_DATAFED_COMPOSE_REPO_FORM_PATH="" # Where the repo form is located also needed for testing
else
local_DATAFED_COMPOSE_REPO_FORM_PATH=$(printenv DATAFED_COMPOSE_REPO_FORM_PATH)
fi
if [ -z "${DATAFED_COMPOSE_GLOBUS_APP_SECRET}" ]
then
local_DATAFED_COMPOSE_GLOBUS_APP_SECRET=""
else
local_DATAFED_COMPOSE_GLOBUS_APP_SECRET=$(printenv DATAFED_COMPOSE_GLOBUS_APP_SECRET)
fi
if [ -z "${DATAFED_COMPOSE_GLOBUS_APP_ID}" ]
then
local_DATAFED_COMPOSE_GLOBUS_APP_ID=""
else
local_DATAFED_COMPOSE_GLOBUS_APP_ID=$(printenv DATAFED_COMPOSE_GLOBUS_APP_ID)
fi
if [ -z "${DATAFED_COMPOSE_ZEROMQ_SESSION_SECRET}" ]
then
local_DATAFED_COMPOSE_ZEROMQ_SESSION_SECRET=""
else
local_DATAFED_COMPOSE_ZEROMQ_SESSION_SECRET=$(printenv DATAFED_COMPOSE_ZEROMQ_SESSION_SECRET)
fi
if [ -z "${DATAFED_COMPOSE_ZEROMQ_SYSTEM_SECRET}" ]
then
local_DATAFED_COMPOSE_ZEROMQ_SYSTEM_SECRET=""
else
local_DATAFED_COMPOSE_ZEROMQ_SYSTEM_SECRET=$(printenv DATAFED_COMPOSE_ZEROMQ_SYSTEM_SECRET)
fi
if [ -z "${DATAFED_COMPOSE_HTTPS_SERVER_PORT}" ]
then
local_DATAFED_COMPOSE_HTTPS_SERVER_PORT="443"
else
local_DATAFED_COMPOSE_HTTPS_SERVER_PORT=$(printenv DATAFED_COMPOSE_HTTPS_SERVER_PORT)
fi
if [ -z "${DATAFED_COMPOSE_CONTAINER_LOG_PATH}" ]
then
local_DATAFED_COMPOSE_CONTAINER_LOG_PATH="/opt/datafed/logs"
else
local_DATAFED_COMPOSE_CONTAINER_LOG_PATH=$(printenv DATAFED_COMPOSE_CONTAINER_LOG_PATH)
fi
if [ -z "${DATAFED_COMPOSE_DATABASE_PASSWORD}" ]
then
local_DATAFED_COMPOSE_DATABASE_PASSWORD="butterscotch"
else
local_DATAFED_COMPOSE_DATABASE_PASSWORD=$(printenv DATAFED_COMPOSE_DATABASE_PASSWORD)
fi

if [ -z "${DATAFED_COMPOSE_DATABASE_IP_ADDRESS}" ]
then
local_DATAFED_COMPOSE_DATABASE_IP_ADDRESS="http://arango"
else
local_DATAFED_COMPOSE_DATABASE_IP_ADDRESS=$(printenv DATAFED_COMPOSE_DATABASE_IP_ADDRESS)
fi

if [ -z "${DATAFED_COMPOSE_DATABASE_PORT}" ]
then
local_DATAFED_COMPOSE_DATABASE_PORT="8529"
else
local_DATAFED_COMPOSE_DATABASE_PORT=$(printenv DATAFED_COMPOSE_DATABASE_PORT)
fi

cat << EOF > ".env"
DATAFED_USER89_PASSWORD="${local_DATAFED_COMPOSE_USER89_PASSWORD}" # For End to end testing
DATAFED_REPO_FORM_PATH="${local_DATAFED_COMPOSE_REPO_FORM_PATH}" # Where the repo form is located also needed for testing
DATAFED_GLOBUS_APP_SECRET="${local_DATAFED_COMPOSE_GLOBUS_APP_SECRET}"
DATAFED_GLOBUS_APP_ID="${local_DATAFED_COMPOSE_GLOBUS_APP_ID}"
DATAFED_ZEROMQ_SESSION_SECRET="${local_DATAFED_COMPOSE_ZEROMQ_SESSION_SECRET}"
DATAFED_ZEROMQ_SYSTEM_SECRET="${local_DATAFED_COMPOSE_ZEROMQ_SYSTEM_SECRET}"
DATAFED_DOMAIN="${local_DATAFED_COMPOSE_DOMAIN}"
DATAFED_HTTPS_SERVER_PORT="${local_DATAFED_COMPOSE_HTTPS_SERVER_PORT}"
DATAFED_WEB_CERT_PATH="/opt/datafed/keys/${local_DATAFED_WEB_CERT_NAME}"
DATAFED_WEB_KEY_PATH="/opt/datafed/keys/${local_DATAFED_WEB_KEY_NAME}"
DATAFED_CONTAINER_LOG_PATH="${local_DATAFED_COMPOSE_CONTAINER_LOG_PATH}"
DATAFED_DATABASE_PASSWORD="${local_DATAFED_COMPOSE_DATABASE_PASSWORD}"
DATAFED_DATABASE_IP_ADDRESS="${local_DATAFED_COMPOSE_DATABASE_IP_ADDRESS}"
DATAFED_DATABASE_PORT="${local_DATAFED_COMPOSE_DATABASE_PORT}"
DATAFED_UID="$(id -u)"
EOF
24 changes: 19 additions & 5 deletions core/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ ARG DEPENDENCIES="dependencies"
ARG RUNTIME="runtime"
ARG DATAFED_DIR="/datafed"
ARG DATAFED_INSTALL_PATH="/opt/datafed"
ARG DATAFED_DEPENDENCIES_INSTALL_PATH="/opt/datafed/dependencies"
ARG GCS_IMAGE="code.ornl.gov:4567/dlsw/datafed/gcs-ubuntu-focal"
ARG BUILD_DIR="$DATAFED_DIR/source"
ARG NVM_DIR="$DATAFED_DIR/.nvm"
ARG NVM_INC="$DATAFED_DIR/.nvm/versions/node/v13.14.0/include/node"
ARG NVM_BIN="$DATAFED_DIR/.nvm/versions/node/v13.14.0/bin"
#ARG NVM_DIR="$DATAFED_DIR/.nvm"
#ARG NVM_INC="$DATAFED_DIR/.nvm/versions/node/v13.14.0/include/node"
#ARG NVM_BIN="$DATAFED_DIR/.nvm/versions/node/v13.14.0/bin"
ARG LIB_DIR="/usr/local/lib"

FROM ${DEPENDENCIES} AS core-build

SHELL ["/bin/bash", "-c"]

ARG DATAFED_DIR
ARG BUILD_DIR
ARG DATAFED_INSTALL_PATH
Expand Down Expand Up @@ -49,13 +52,16 @@ RUN cmake --build build --target install

FROM ${RUNTIME} AS core

SHELL ["/bin/bash", "-c"]

ARG DATAFED_DIR
ARG DATAFED_INSTALL_PATH
ARG BUILD_DIR
ARG LIB_DIR

# The above should also be available at runtime
ENV DATAFED_INSTALL_PATH="$DATAFED_INSTALL_PATH"
ENV DATAFED_DEPENDENCIES_INSTALL_PATH="${DATAFED_DEPENDENCIES_INSTALL_PATH}"
ENV DATAFED_DIR="$DATAFED_DIR"
ENV BUILD_DIR="$BUILD_DIR"
ENV LIB_DIR="$LIB_DIR"
Expand All @@ -81,5 +87,13 @@ COPY --chown=datafed:root ./cmake/Version.cmake ${DATAFED_DIR}/cmake
COPY --from=core-build --chown=datafed:root ${BUILD_DIR}/core/docker/entrypoint.sh ${BUILD_DIR}/core/entrypoint.sh
COPY --from=core-build --chown=datafed:root ${DATAFED_INSTALL_PATH}/core/datafed-core ${DATAFED_INSTALL_PATH}/core/datafed-core

ENTRYPOINT ["${BUILD_DIR}/core/entrypoint.sh"]
CMD ["${DATAFED_INSTALL_PATH}/core/datafed-core","--cfg","${DATAFED_INSTALL_PATH}/core/datafed-core.cfg"]
USER root

RUN chown -R datafed:root /datafed
RUN chown -R datafed:root /opt

#SHELL ["/bin/bash"]
# NOTE docker does not recognize curly braces around variables in entrypoint
# and CMD
ENTRYPOINT [ "/datafed/source/core/entrypoint.sh", "/opt/datafed/core/datafed-core","--cfg", "/opt/datafed/core/datafed-core.cfg"]
#CMD ["$DATAFED_INSTALL_PATH/core/datafed-core","--cfg","$DATAFED_INSTALL_PATH/core/datafed-core.cfg"]
1 change: 1 addition & 0 deletions core/docker/Dockerfile.core-base.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ COPY ./scripts/generate_datafed.sh ${BUILD_DIR}/scripts/
COPY ./scripts/dependency_install_functions.sh ${BUILD_DIR}/scripts/
COPY ./scripts/dependency_versions.sh ${BUILD_DIR}/scripts/
COPY ./scripts/install_core_dependencies.sh ${BUILD_DIR}/scripts/
COPY ./scripts/utils.sh ${BUILD_DIR}/scripts/

RUN echo "#!/bin/bash\n\$@" > /usr/bin/sudo && chmod +x /usr/bin/sudo
RUN ${BUILD_DIR}/scripts/generate_datafed.sh
Expand Down
Loading
Loading