Created
June 6, 2022 07:08
-
-
Save vatsalsaglani/8bb6761ed373ad05277b9833cad96c34 to your computer and use it in GitHub Desktop.
Dockerfile and requirements for Lambda OpenCV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define function directory | |
ARG FUNCTION_DIR="/function" | |
FROM python:3.7 as build-image | |
RUN apt-get update | |
RUN apt-get install -y | |
# RUN apt install python3-opencv -y | |
RUN apt install curl -y | |
# Include global arg in this stage of the build | |
ARG FUNCTION_DIR | |
# Create function directory | |
RUN mkdir -p ${FUNCTION_DIR} | |
# RUN mkdir -p /tmp/input-images | |
# RUN mkdir -p /tmp/output-images | |
RUN mkdir -p ${FUNCTION_DIR}/popular-memes | |
COPY ./*.py ${FUNCTION_DIR} | |
COPY ./popular-memes/*.png ${FUNCTION_DIR}/popular-memes | |
COPY ./requirements.txt ${FUNCTION_DIR} | |
RUN curl -L https://vs-bucket-allthings.s3.us-east-2.amazonaws.com/antelope.tar.gz -o ${FUNCTION_DIR}/antelope.tar.gz && tar xvzf ${FUNCTION_DIR}/antelope.tar.gz -C ${FUNCTION_DIR}/ | |
RUN rm ${FUNCTION_DIR}/antelope.tar.gz | |
RUN curl -L https://vs-bucket-allthings.s3.us-east-2.amazonaws.com/arcface_checkpoint.tar -o ${FUNCTION_DIR}/arcface_checkpoint.tar | |
RUN curl -L https://vs-bucket-allthings.s3.us-east-2.amazonaws.com/checkpoints.tar.gz -o ${FUNCTION_DIR}/checkpoints.tar.gz && tar xvzf ${FUNCTION_DIR}/checkpoints.tar.gz -C ${FUNCTION_DIR}/ | |
RUN rm ${FUNCTION_DIR}/checkpoints.tar.gz | |
RUN ls ${FUNCTION_DIR} | |
RUN pip install -r ${FUNCTION_DIR}/requirements.txt --target ${FUNCTION_DIR} awslambdaric | |
FROM python:3.7 | |
ARG FUNCTION_DIR | |
WORKDIR ${FUNCTION_DIR} | |
COPY --from=build-image ${FUNCTION_DIR} ${FUNCTION_DIR} | |
ENTRYPOINT [ "/usr/local/bin/python", "-m", "awslambdaric" ] | |
CMD ["app.handler"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Flask | |
Pillow | |
torch | |
torchvision | |
opencv-python-headless | |
insightface==0.2.1 | |
onnxruntime | |
moviepy | |
imageio==2.4.1 | |
# flask_cors | |
requests |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment