Compare commits

..

3 Commits

Author SHA1 Message Date
Adib Pratama 39ceb97e87 Reduce requirements size 1 year ago
Adib Pratama 8d913f9324 Remove no-cache-dir 1 year ago
Adib Pratama 5af782679a Fix on MaC 1 year ago
  1. 5
      Dockerfile
  2. 4
      requirements.txt
  3. 14
      run.sh

@ -5,7 +5,8 @@ COPY requirements.txt ./
RUN apt update RUN apt update
RUN apt install -y zip RUN apt install -y zip
RUN mkdir -p ./python RUN mkdir -p ./python
RUN pip install --no-cache-dir -r requirements.txt -t python/ RUN pwd
RUN zip -r python_layer.zip python RUN pip install -r requirements.txt -t python/
RUN zip -r python.zip python
# ENTRYPOINT ["tail", "-f", "/dev/null"] # ENTRYPOINT ["tail", "-f", "/dev/null"]

@ -1,3 +1 @@
pandas seaborn
scikit-learn
numpy

@ -3,17 +3,17 @@
IMAGE_NAME=python_aws_layer.image IMAGE_NAME=python_aws_layer.image
CONTAINER_NAME=python_aws_layer.container CONTAINER_NAME=python_aws_layer.container
docker buildx build . -t $IMAGE_NAME:latest docker build . -t $IMAGE_NAME:latest
# check if container exists # check if container exists
if [ ! "$(docker ps -a -q -f name=$CONTAINER_NAME)" ]; then if [ "$(docker ps -a -q -f name=$CONTAINER_NAME)" ]; then
# check if it exited
if [ "$(docker ps -aq -f status=exited -f name=$CONTAINER_NAME)" ]; then
# cleanup # cleanup
docker rm $CONTAINER_NAME docker rm $CONTAINER_NAME
fi fi
# run your container docker run \
docker run --name $CONTAINER_NAME $IMAGE_NAME --name $CONTAINER_NAME \
fi --platform linux/amd64 \
-dit \
$IMAGE_NAME
docker cp $CONTAINER_NAME:/usr/src/app/python.zip . docker cp $CONTAINER_NAME:/usr/src/app/python.zip .
docker stop $CONTAINER_NAME docker stop $CONTAINER_NAME

Loading…
Cancel
Save