I want to use clamscan in node.js. Can anyone please suggest the steps if knows

401 Views Asked by At

Trying to install clamscan using docker file, here is my docker snippet

#Define the image we want to build from
FROM node:16.19.1-alpine3.17

#Copy the current directory to a newly created working directory
COPY --chown=1000 . /code

#Define the working directory - Change this to the directory your Node app is defined in
WORKDIR /code/server

RUN apk update && apk upgrade

RUN npm install --quiet node-gyp -g

# Run image as root user
USER root

RUN apk --no-cache add clamav clamav-daemon freshclam clamav-libunrar supervisor

RUN sed -i 's/^Foreground .*$/Foreground true/g' /etc/clamav/clamd.conf && \
    echo 'TCPSocket 3310' >> /etc/clamav/clamd.conf && \
    sed -i 's/^Foreground .*$/Foreground true/g' /etc/clamav/freshclam.conf

RUN freshclam

RUN mkdir /run/clamav && chown clamav:clamav /run/clamav

EXPOSE 3310/tcp

# Run image as non-root user
USER node

RUN npm rebuild

#This app binds to the below specified port, so we use the EXPOSE instruction to have it mapped by the docker daemon
EXPOSE 11012

# Run image as non-root user
USER node

# Run application
CMD [ "node", "server.js"]

when i started to using the clamscan.isInfected(localFullPath) nodejs application it throws the below error,

/usr/bin/clamdscan --no-summary --fdpass --multiscan /code/server/attachments/image.jpeg

0

There are 0 best solutions below