diff --git a/Dockerfile b/Dockerfile index a59b66e3..62a54838 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,20 +5,21 @@ RUN mkdir -p /opt/app RUN mkdir -p /opt/app/build RUN mkdir -p /opt/app/bin/ -# Copy in the lambda source -WORKDIR /opt/app -COPY ./*.py /opt/app/ -COPY requirements.txt /opt/app/requirements.txt - # Install packages RUN yum update -y RUN yum install -y cpio python3-pip yum-utils zip unzip less RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm +# Install requirements +WORKDIR /opt/app +COPY requirements.txt /opt/app/requirements.txt # This had --no-cache-dir, tracing through multiple tickets led to a problem in wheel RUN pip3 install -r requirements.txt RUN rm -rf /root/.cache/pip +# Copy in the lambda source +COPY ./*.py /opt/app/ + # Download libraries we need to run in lambda WORKDIR /tmp RUN yumdownloader -x \*i686 --archlist=x86_64 clamav clamav-lib clamav-update json-c pcre2 diff --git a/Makefile b/Makefile index a527b641..b17373f2 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,10 @@ clean: ## Clean build artifacts find ./ -type d -name '__pycache__' -delete find ./ -type f -name '*.pyc' -delete +.PHONY: cleandocker +cleandocker: clean + docker rmi bucket-antivirus-function:latest + .PHONY: archive archive: clean ## Create the archive for AWS lambda docker build -t bucket-antivirus-function:latest .