build: move to poetry
This commit is contained in:
parent
d7756a7184
commit
44bbe77a5b
35
Dockerfile
35
Dockerfile
@ -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"]
|
||||
|
1924
poetry.lock
generated
Normal file
1924
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
27
pyproject.toml
Normal file
27
pyproject.toml
Normal file
@ -0,0 +1,27 @@
|
||||
[tool.poetry]
|
||||
name = "robocar-training"
|
||||
version = "0.0.0"
|
||||
description = "DIY Robocars model training"
|
||||
authors = ["Cyrille Nofficial <cynoffic@cyrilix.fr>"]
|
||||
license = "Apache2"
|
||||
readme = "README.md"
|
||||
packages = [{include = "tf_container"}, {include="tensorflow-stubs"}]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = ">=3.10,<3.11"
|
||||
sagemaker-training = "^4.2.0"
|
||||
tensorflow = "^2.10.0"
|
||||
numpy = "^1.23.4"
|
||||
pillow = "^8.3.2"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
mypy = "^0.982"
|
||||
pylint = "^2.15.5"
|
||||
tensor-annotations = "^2.0.2"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
|
||||
build-backend = "poetry_dynamic_versioning.backend"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
train = 'tf_container.train:main'
|
@ -1,4 +0,0 @@
|
||||
sagemaker-training==4.2.0
|
||||
tensorflow==2.10.0
|
||||
numpy
|
||||
pillow==8.3.2
|
31
setup.py
31
setup.py
@ -1,31 +0,0 @@
|
||||
import os
|
||||
from os.path import basename
|
||||
from os.path import splitext
|
||||
|
||||
from glob import glob
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
|
||||
def read(fname):
|
||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||
|
||||
|
||||
setup(
|
||||
name='robocars_sagemaker_container',
|
||||
version='1.0.0',
|
||||
|
||||
packages=find_packages(where='src', exclude=('test',)),
|
||||
package_dir={'': 'src'},
|
||||
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
|
||||
|
||||
classifiers=[
|
||||
'Programming Language :: Python :: 3.7',
|
||||
],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'train=tf_container.train_entry_point:train',
|
||||
]
|
||||
},
|
||||
install_requires=['sagemaker-container-support'],
|
||||
extras_require={},
|
||||
)
|
Loading…
Reference in New Issue
Block a user