PUNCH-Cyber / YaraGuardian

Django web interface for managing Yara rules
Apache License 2.0
190 stars 43 forks source link

Can't run app in docker, `docker-compose run web yarn` fails with error #56

Open unstppbl opened 5 years ago

unstppbl commented 5 years ago

docker build . cmd output:

Sending build context to Docker daemon   2.37MB
Step 1/12 : FROM ubuntu:16.04
 ---> 4a689991aa24
Step 2/12 : MAINTAINER Adam Trask ”adam@punchcyber.com”
 ---> Using cache
 ---> 3bcebe9f88ac
Step 3/12 : ENV LANG='C.UTF-8' LC_ALL='C.UTF-8' LANGUAGE='C.UTF-8' NODE_VERSION='8.0.0'
 ---> Using cache
 ---> aa6469c49987
Step 4/12 : ENV API_DIR='/usr/local/YaraGuardian' API_USER='YaraManager' API_GROUP='YaraManager'
 ---> Using cache
 ---> c8e7fa61c80c
Step 5/12 : ADD . ${API_DIR}
 ---> Using cache
 ---> 2211e8de80bc
Step 6/12 : RUN apt-get update   && apt-get -y install software-properties-common   && apt-add-repository -y multiverse   && apt-get update   && apt-get upgrade -y   && echo "Installing prerequisite packages..."   && apt-get -y install     curl     git     libpq-dev     npm     python3     python3-dev     python3-setuptools   && easy_install3 pip   && apt-get clean -y   && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 ---> Using cache
 ---> a58747f972d0
Step 7/12 : WORKDIR ${API_DIR}
 ---> Using cache
 ---> 432e3b9e88e6
Step 8/12 : RUN echo "Installing NodeJS version ${NODE_VERSION}"   && npm cache clean -f   && npm install -g n   && n ${NODE_VERSION}   && ln -sf /usr/local/n/versions/node/${NODE_VERSION}/bin/node /usr/bin/node   && echo "Installing python requirements..."   && pip3 install pipenv   && pipenv install --deploy --system   && echo "Installing front-end components"   && npm install yarn -g   && yarn   && yarn webpack   && python3 manage.py collectstatic --noinput   && rm -rf /usr/local/n
 ---> Using cache
 ---> 0af428884f8b
Step 9/12 : RUN groupadd -r ${API_USER}   && useradd -r -g ${API_GROUP} ${API_USER}   && chown -R ${API_USER}:${API_GROUP} ${API_DIR}
 ---> Using cache
 ---> 4ca1b12def0b
Step 10/12 : EXPOSE 8080
 ---> Using cache
 ---> 1098b35d97b3
Step 11/12 : USER ${API_USER}
 ---> Using cache
 ---> abf0d30edd56
Step 12/12 : CMD PYTHONUNBUFFERED=1 gunicorn -k gevent --bind=0.0.0.0:8080 --access-logfile - --error-logfile - YaraGuardian.wsgi:application
 ---> Using cache
 ---> 0a88da07ffb9
Successfully built 0a88da07ffb9

docker-compose run web yarn cmd output fails with error:

Starting yaraguardian_db_1 ... done
yarn install v1.10.1
warning Skipping preferred cache folder "/home/YaraManager/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-999".
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
error Could not write file "/usr/local/YaraGuardian/yarn-error.log": "EACCES: permission denied, open '/usr/local/YaraGuardian/yarn-error.log'"
error An unexpected error occurred: "EACCES: permission denied, mkdir '/usr/local/YaraGuardian/node_modules'".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: ENOENT: no such file or directory, open '/home/YaraManager/.yarnrc'
remiallain commented 5 years ago

I've experienced exactly the same issue, someone have a fix ?