build: move to poetry

This commit is contained in:
2022-10-27 14:25:32 +02:00
parent d7756a7184
commit 44bbe77a5b
7 changed files with 1974 additions and 47 deletions

View File

@ -1,15 +1,26 @@
FROM docker.io/tensorflow/tensorflow:2.10.0
FROM docker.io/library/python:3.10-slim as base
COPY requirements.txt .
RUN pip3 install --upgrade pip==22.2.2 && pip3 list && pip3 install -r requirements.txt \
&& pip3 list
WORKDIR /root
# copy the training script inside the container
COPY src/tf_container/train.py /opt/ml/code/train.py
# define train.py as the script entry point
ENV SAGEMAKER_PROGRAM train.py
# Configure piwheels repo to use pre-compiled numpy wheels for arm
RUN echo -n "[global]\nextra-index-url=https://www.piwheels.org/simple\n" >> /etc/pip.conf
#################
FROM base as builder
RUN apt-get update && apt-get install -y git && \
pip3 install poetry==1.2.0 && \
poetry self add "poetry-dynamic-versioning[plugin]"
ADD . .
RUN poetry build
#################
FROM base
COPY --from=builder dist/*.whl /tmp/
RUN pip3 install /tmp/*whl
WORKDIR /tmp
USER 1234
ENTRYPOINT ["/usr/local/bin/train"]