Skip to content

Commit

Permalink
Merge pull request #1 from trussworks/mb-13103-python3.8
Browse files Browse the repository at this point in the history
[MB-13103] fix virus database update failure
  • Loading branch information
chtakahashi authored Jul 26, 2022
2 parents 0e86c59 + e86a0dc commit 2d3bab8
Showing 1 changed file with 39 additions and 21 deletions.
60 changes: 39 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,52 @@ 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

# 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
RUN yum update -y && \
amazon-linux-extras install epel -y && \
yum install -y cpio yum-utils tar.x86_64 gzip zip python3-pip shadow-utils.x86_64 && \
pip3 install -r requirements.txt && \
rm -rf /root/.cache/pip

# 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 libprelude gnutls libtasn1 lib64nettle nettle
RUN rpm2cpio clamav-0*.rpm | cpio -idmv
RUN rpm2cpio clamav-lib*.rpm | cpio -idmv
RUN rpm2cpio clamav-update*.rpm | cpio -idmv
RUN rpm2cpio json-c*.rpm | cpio -idmv
RUN rpm2cpio pcre*.rpm | cpio -idmv
RUN rpm2cpio gnutls* | cpio -idmv
RUN rpm2cpio nettle* | cpio -idmv
RUN rpm2cpio lib* | cpio -idmv
RUN rpm2cpio *.rpm | cpio -idmv
RUN rpm2cpio libtasn1* | cpio -idmv
RUN yumdownloader -x \*i686 --archlist=x86_64 \
clamav clamav-lib clamav-update json-c \
pcre2 libtool-ltdl libxml2 bzip2-libs \
xz-libs libprelude gnutls nettle

RUN rpm2cpio clamav-0*.rpm | cpio -vimd && \
rpm2cpio clamav-lib*.rpm | cpio -vimd && \
rpm2cpio clamav-update*.rpm | cpio -vimd && \
rpm2cpio json-c*.rpm | cpio -vimd && \
rpm2cpio pcre*.rpm | cpio -vimd && \
rpm2cpio libtool-ltdl*.rpm | cpio -vimd && \
rpm2cpio libxml2*.rpm | cpio -vimd && \
rpm2cpio bzip2-libs*.rpm | cpio -vimd && \
rpm2cpio xz-libs*.rpm | cpio -vimd && \
rpm2cpio libprelude*.rpm | cpio -vimd && \
rpm2cpio gnutls*.rpm | cpio -vimd && \
rpm2cpio nettle*.rpm | cpio -vimd


# Copy over the binaries and libraries
RUN cp /tmp/usr/bin/clamscan /tmp/usr/bin/freshclam /tmp/usr/lib64/* /opt/app/bin/
RUN cp /tmp/usr/bin/clamscan \
/tmp/usr/bin/freshclam \
/tmp/usr/lib64/* \
/usr/lib64/libpcre.so.1 \
/opt/app/bin/

# Fix the freshclam.conf settings
RUN echo "DatabaseMirror database.clamav.net" > /opt/app/bin/freshclam.conf
RUN echo "CompressLocalDatabase yes" >> /opt/app/bin/freshclam.conf
RUN echo "DatabaseMirror database.clamav.net" > /opt/app/bin/freshclam.conf && \
echo "CompressLocalDatabase yes" >> /opt/app/bin/freshclam.conf && \
echo "ScriptedUpdates no" >> /opt/app/bin/freshclam.conf && \
echo "DatabaseDirectory /var/lib/clamav" >> /opt/app/bin/freshclam.conf

RUN groupadd clamav
RUN useradd -g clamav -s /bin/false -c "Clam Antivirus" clamav
RUN useradd -g clamav -s /bin/false -c "Clam Antivirus" clamupdate

ENV LD_LIBRARY_PATH=/opt/app/bin
RUN ldconfig

# Create the zip file
WORKDIR /opt/app
Expand Down

0 comments on commit 2d3bab8

Please sign in to comment.