Skip to content

Commit

Permalink
Merge pull request #383 from grycap/dev_micafer
Browse files Browse the repository at this point in the history
Improve container image docs
  • Loading branch information
micafer committed Nov 15, 2022
2 parents 3c81d07 + ecc76f9 commit 15a87d8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/source/image_env_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,32 @@ flag in the function definition::
image: 000000000000.dkr.ecr.us-east-1.amazonaws.com/scar-function
create_image: false

But this ECR image must have been prepared to work with scar. So it must have the
``init_script`` and the ``supervisor`` installed and set it as the ``CMD`` of the docker
image. You can use this example to create your own ``Dockefile``::

from your_repo/your_image

# Create a base dir
ARG FUNCTION_DIR="/var/task"
WORKDIR ${FUNCTION_DIR}
# Set workdir in the path
ENV PATH="${FUNCTION_DIR}:${PATH}"
# Add PYTHONIOENCODING to avoid UnicodeEncodeError as sugested in:
# https://github.com/aws/aws-lambda-python-runtime-interface-client/issues/19
ENV PYTHONIOENCODING="utf8"

# Copy your script, similar to:
# https://github.com/grycap/scar/blob/master/examples/darknet/yolo.sh
COPY script.sh ${FUNCTION_DIR}
# Download the supervisor binary
# https://github.com/grycap/faas-supervisor/releases/latest
# Copy the supervisor
COPY supervisor ${FUNCTION_DIR}
# Set it as the CMD
CMD [ "supervisor" ]


Do not delete ECR image on function deletion
--------------------------------------------

Expand Down

0 comments on commit 15a87d8

Please sign in to comment.