Skip to content

Commit

Permalink
Separate dockerfiles into a base and app file
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlycoconuts committed Feb 11, 2022
1 parent 339c3e3 commit 8fb53c7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
22 changes: 1 addition & 21 deletions engines/real-time-ensembler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,4 @@ RUN conda env create -f ./environment.yaml && \
rm -rf /root/.cache

# Install conda-pack:
RUN conda install -c conda-forge conda-pack

# Use conda-pack to create a standalone enviornment
# in /venv:
RUN conda-pack -n real-time-ensembler -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar

RUN /venv/bin/conda-unpack

FROM debian:latest

COPY --from=builder /ensembler ./ensembler
COPY --from=builder /pyfunc_ensembler_runner ./pyfunc_ensembler_runner
COPY --from=builder /run.sh /run.sh
COPY --from=builder /venv /venv

RUN /bin/bash -c ". /venv/bin/activate && \
python -m pyfunc_ensembler_runner --mlflow_ensembler_dir /ensembler --dry_run"

CMD ["/bin/bash", "./run.sh"]
RUN conda install -c conda-forge conda-pack
30 changes: 30 additions & 0 deletions engines/real-time-ensembler/app.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG BASE_IMAGE

FROM ${BASE_IMAGE} as builder

ARG MODEL_URL
RUN gsutil -m cp -r ${MODEL_URL} .
ARG FOLDER_NAME

# Install dependencies required by the user-defined ensembler
RUN /bin/bash -c ". activate ${CONDA_ENVIRONMENT} && conda env update --name ${CONDA_ENVIRONMENT} --file /${HOME}/${FOLDER_NAME}/conda.yaml"

# Use conda-pack to create a standalone enviornment
# in /venv:
RUN conda-pack -n real-time-ensembler -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar

RUN /venv/bin/conda-unpack

FROM debian:latest

COPY --from=builder /ensembler ./ensembler
COPY --from=builder /pyfunc_ensembler_runner ./pyfunc_ensembler_runner
COPY --from=builder /run.sh /run.sh
COPY --from=builder /venv /venv

RUN /bin/bash -c ". /venv/bin/activate && \
python -m pyfunc_ensembler_runner --mlflow_ensembler_dir /ensembler --dry_run"

CMD ["/bin/bash", "./run.sh"]

0 comments on commit 8fb53c7

Please sign in to comment.