0

I am trying to create a dockerfile for a simple mobile test script I tried my hands on in robot framework. below is the Dockerfile I created. The build has not been successful, I need help in getting it right

FROM python:3
MAINTAINER  Ademola Bhadmus, bhadmusademola.1@gmail.com
ENV env=/root/env
ENV PATH="$env/bin:$PATH"
WORKDIR  /root
# Copy relevant files to work directory
COPY Resources .
COPY Results .
COPY Tests .
# Install Python, Robot, and Appium
COPY requirements.txt .
RUN pip3 install --no-cache-dir --upgrade pip
RUN python3 -m venv $env
RUN pip3 install --no-cache-dir -r requirements.txt
FROM node:latest
RUN mkdir -p /usr/app
WORKDIR /usr/app
COPY . .
RUN npm install -g appium
# Execute file
CMD ["appium"]
CMD ["robot", "-d", "results", "index.robot"]

I got this error

npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /usr/local/lib/node_modules/appium/node_modules/.bin/authorize-ios
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/appium/node_modules/.bin/authorize-ios'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-01-01T06_52_36_641Z-debug.log
What am I doing wrong? (edited) 

Please what am I doing wrong?

  • 2
    seems to be the same issue https://stackoverflow.com/questions/64655932/bin-authorize-ios-not-found-when-installing-appium-using-npm-install-g-appium – J Asgarov Jan 01 '21 at 10:24

1 Answers1

1
FROM node:lts
RUN npm -v
RUN node -v
#RUN npm install -g appium --chromedriver-skip-install
RUN npm install -g appium --unsafe-perm=true --allow-root

# Execute file
CMD ["appium"]
CMD ["robot", "-d", "results", "index.robot"]

the latest version is node 15 and has npm version 7+ which is not supported as of now , use node lts .

Also you have to use skip chrome driver installation and copy it with additional step due to permission error

else you can pass --unsafe-perm=true --allow-root as added in docker file to install it through script itself

PDHide
  • 18,113
  • 2
  • 31
  • 46
  • I used the skip chrome driver installation and it worked but when I tried to run the image, I got this error ``` docker run --rm mobileimage internal/modules/cjs/loader.js:883 throw err; ^ Error: Cannot find module '/robot' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15) at Function.Module._load (internal/modules/cjs/loader.js:725:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } ``` – i_m_sanguine Jan 03 '21 at 09:01
  • you have to installl robotfraomework RUN pip install robotframework – PDHide Jan 03 '21 at 09:02
  • thatsnot there in your requirement.txt ? – PDHide Jan 03 '21 at 09:03
  • you need to use your original dockerfile and just replace `from node:latest` with from `node:lts` and `RUN npm install -g appium` with `RUN npm install -g appium --unsafe-perm=true --allow-root ` . – PDHide Jan 03 '21 at 09:05