FROM ubuntu:18.04
RUN apt-get -y update
RUN apt-get install -y python3.6
RUN apt-get install -y --no-install-recommends python3-pip
RUN apt-get install -y python3-setuptools
RUN ln -s /usr/bin/python3 /usr/bin/python & \
ln -s /usr/bin/pip3 /usr/bin/pip
RUN pip install flask
RUN pip install pandas
RUN pip install scikit-learn
RUN pip install joblib
WORKDIR /usr/local/bin
EXPOSE 8080
FROM arvslat/amazon-sagemaker-cookbook-python-base:1
COPY train /usr/local/bin/train
COPY serve /usr/local/bin/serve
IMAGE_URI=<insert ECR URI here>
TAG=1
docker build --no-cache -t $IMAGE_URI:$TAG .
docker run --name pytrain --rm -v /opt/ml:/opt/ml $IMAGE_URI:$TAG train
docker run --name pyserve --rm -v /opt/ml:/opt/ml $IMAGE_URI:$TAG serve
SERVE_IP=$(docker network inspect bridge | jq -r ".[0].Containers[].IPv4Address" | awk -F/ '{print $1}')
curl http://$SERVE_IP:8080/ping
curl -d "data=1" -X POST http://$SERVE_IP:8080/invocations
docker push $IMAGE_URI:$TAG
Content type
Image
Digest
Size
212.4 MB
Last updated
over 5 years ago
docker pull arvslat/amazon-sagemaker-cookbook-python-base:1