Skip to content

Commit

Permalink
Example conda project
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub <noreply@github.com>
  • Loading branch information
Jacob Woffenden authored Aug 27, 2024
1 parent 75cff2a commit 085d69d
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
11 changes: 11 additions & 0 deletions example-project/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ghcr.io/ministryofjustice/analytical-platform-airflow-python-base:local

ENV CONDA_ENVIRONMENT_NAME="example-project"

COPY --chown=${CONTAINER_USER}:${CONTAINER_GROUP} example-project/src/opt/analytical-platform/ /opt/analytical-platform/
RUN <<EOF
conda env create --yes --name "${CONDA_ENVIRONMENT_NAME}" --file /opt/analytical-platform/conda.yaml
EOF

COPY --chown=nobody:nogroup --chmod=0775 example-project/src/usr/local/bin/entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
10 changes: 10 additions & 0 deletions example-project/src/opt/analytical-platform/conda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
channels:
- defaults
- conda-forge

dependencies:
- python=3.9
- pip
- pip:
- --requirement requirements.txt
41 changes: 41 additions & 0 deletions example-project/src/opt/analytical-platform/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
absl-py==2.1.0
astunparse==1.6.3
cachetools==5.5.0
certifi==2024.7.4
charset-normalizer==3.3.2
flatbuffers==24.3.25
gast==0.6.0
google-auth==2.34.0
google-auth-oauthlib==1.2.1
google-pasta==0.2.0
grpcio==1.66.0
h5py==3.11.0
idna==3.8
importlib_metadata==8.4.0
keras==2.15.0
libclang==18.1.1
Markdown==3.7
MarkupSafe==2.1.5
ml-dtypes==0.2.0
numpy==1.26.4
oauthlib==3.2.2
opt-einsum==3.3.0
packaging==24.1
protobuf==4.25.4
pyasn1==0.6.0
pyasn1_modules==0.4.0
requests==2.32.3
requests-oauthlib==2.0.0
rsa==4.9
six==1.16.0
tensorboard==2.15.2
tensorboard-data-server==0.7.2
tensorflow==2.15.0
tensorflow-estimator==2.15.0
tensorflow-io-gcs-filesystem==0.37.1
termcolor==2.4.0
typing_extensions==4.12.2
urllib3==2.2.2
Werkzeug==3.0.4
wrapt==1.14.1
zipp==3.20.1
7 changes: 7 additions & 0 deletions example-project/src/opt/analytical-platform/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import sys
import tensorflow as tf

print("Python version:", sys.version)

devices = tf.config.list_physical_devices()
print("TensorFlow devices:", devices)
10 changes: 10 additions & 0 deletions example-project/src/usr/local/bin/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# Initialise conda
source /opt/conda/etc/profile.d/conda.sh

# Activate the conda environment
conda activate "${CONDA_ENVIRONMENT_NAME}"

# Run the command
python run.py

0 comments on commit 085d69d

Please sign in to comment.