forked from aws-samples/aws-serverless-s3-antivirus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
30 lines (18 loc) · 847 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
FROM public.ecr.aws/lambda/python:3.8
RUN yum update -y
RUN python -m pip install --upgrade pip
RUN yum install amazon-linux-extras -y
# Python3 doesn't recognize this package yet. https://forums.aws.amazon.com/thread.jspa?messageID=930259
RUN PYTHON=python2 amazon-linux-extras install epel -y
RUN yum install -y gcc gcc-c++ clamav clamd clamav-update \
&& ln -s /etc/freshclam.conf /tmp/freshclam.conf
COPY function/virus-scanner.py ${LAMBDA_TASK_ROOT}/
COPY clamd.conf /etc/clamd.conf
COPY ./requirements.txt ${LAMBDA_TASK_ROOT}/requirements.txt
RUN cd ${LAMBDA_TASK_ROOT}
RUN pip install -r ${LAMBDA_TASK_ROOT}/requirements.txt -t .
# Force running freshclam everytime the image is being built, so new antivirus definitions are downloaded
ARG CACHEBUST=1
RUN echo $CACHEBUST
RUN freshclam
CMD [ "virus-scanner.lambda_handler" ]