From ac72a582136fae3a613c18b7b78d0dd8b40642cd Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Tue, 29 Aug 2023 19:11:22 +0100 Subject: [PATCH] add simple docker files for now --- .../Dockerfiles/Dockerfile.prediction | 37 +++++++++++++++++++ .../Dockerfiles/Dockerfile.training | 37 +++++++++++++++++++ .../predictions/predictions-dev.txt | 1 + 3 files changed, 75 insertions(+) create mode 100644 model_data/simulation_system/Dockerfiles/Dockerfile.prediction create mode 100644 model_data/simulation_system/Dockerfiles/Dockerfile.training diff --git a/model_data/simulation_system/Dockerfiles/Dockerfile.prediction b/model_data/simulation_system/Dockerfiles/Dockerfile.prediction new file mode 100644 index 00000000..c0efdb5f --- /dev/null +++ b/model_data/simulation_system/Dockerfiles/Dockerfile.prediction @@ -0,0 +1,37 @@ +FROM python:3.10.12-slim as release + +ARG USER=nroot +ARG UID=1000 +ARG GID=100 + +# Install patches +RUN apt-get update && apt-get upgrade -y \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists + +# Install python packages +COPY ../requirements/predictions/predictions.txt requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +# Create and configure non-root user +RUN useradd \ + --create-home \ + --uid ${UID} \ + --gid ${GID} \ + --shell /bin/bash \ + ${USER} + +# Copy the project code to user home directory +COPY --chown=${UID}:${GID} ./core /home/simulation_system/core +COPY --chown=${UID}:${GID} ./MLModel /home/simulation_system/MLModel +COPY --chown=${UID}:${GID} ./predictions.py /home/simulation_system/predictions.py + +# FOR TESTING +# COPY --chown=${UID}:${GID} ./model_build_data /home/simulation_system/model_build_data + +# Switch user +USER ${USER} +WORKDIR /home/simulation_system + +# Run the python command +CMD ["python3", "predictions.py", "--data-path", "./model_build_data/change_data/rdsap_full/test_data.parquet"] diff --git a/model_data/simulation_system/Dockerfiles/Dockerfile.training b/model_data/simulation_system/Dockerfiles/Dockerfile.training new file mode 100644 index 00000000..e1bac199 --- /dev/null +++ b/model_data/simulation_system/Dockerfiles/Dockerfile.training @@ -0,0 +1,37 @@ +FROM python:3.10.12-slim as release + +ARG USER=nroot +ARG UID=1000 +ARG GID=100 + +# Install patches +RUN apt-get update && apt-get upgrade -y \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists + +# Install python packages +COPY ../requirements/training/training-dev.txt requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +# Create and configure non-root user +RUN useradd \ + --create-home \ + --uid ${UID} \ + --gid ${GID} \ + --shell /bin/bash \ + ${USER} + +# Copy the project code to user home directory +COPY --chown=${UID}:${GID} ./core /home/simulation_system/core +COPY --chown=${UID}:${GID} ./MLModel /home/simulation_system/MLModel +COPY --chown=${UID}:${GID} ./training.py /home/simulation_system/training.py + +# FOR TESTING +# COPY --chown=${UID}:${GID} ./model_build_data /home/simulation_system/model_build_data + +# Switch user +USER ${USER} +WORKDIR /home/simulation_system + +# Run the python command +CMD ["python3", "training.py", "--train-filepath", "./model_build_data/change_data/rdsap_full/train_validation_data.parquet", "--test-filepath", "./model_build_data/change_data/rdsap_full/test_data.parquet"] diff --git a/model_data/simulation_system/requirements/predictions/predictions-dev.txt b/model_data/simulation_system/requirements/predictions/predictions-dev.txt index ae7457ee..0574e0f5 100644 --- a/model_data/simulation_system/requirements/predictions/predictions-dev.txt +++ b/model_data/simulation_system/requirements/predictions/predictions-dev.txt @@ -1,2 +1,3 @@ autogluon==0.8.2 pandas==1.5.3 +pre-commit==3.3.3