Hi, It’s me again …
I’m facing this “odd” issue.
Our test is not stable on node:8-slim due to unknown reason and we’re decided to use node:10-slim for testing step only and build on node:8-slim. However this decision didn’t work well for us.
Test is passed, image is built. But our application is complaining that it’s built on wrong node version.
This is my .drone.yml
pipeline:
install:
image: node:10-slim
commands:
- node -v
- npm -v
- yarn --version
- yarn config set cache-folder .yarn-cache
- yarn install
test:
....
....
publish:
image: plugins/docker
repo: my-private-repo.com/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}
registry: my-private-repo.com
dockerfile: Dockerfile
secrets: [ docker_username, docker_password ]
tags:
- ${DRONE_BRANCH}-latest
when:
branch: master
event: push
status: success
And this is the Dockerfile:
FROM node:8-slim
WORKDIR /app/
COPY package.json .
RUN yarn
COPY . .
RUN cp .env.sample .env
RUN yarn build
RUN chown -R node:node /app
USER node
EXPOSE 3000
CMD ["yarn", "start"]
yarn run v1.9.4
11/20/2018 6:29:11 PM $ node dist
11/20/2018 6:29:11 PM module.js:682
11/20/2018 6:29:11 PM return process.dlopen(module, path._makeLong(filename));
11/20/2018 6:29:11 PM ^
11/20/2018 6:29:11 PM
11/20/2018 6:29:11 PM Error: The module '/app/node_modules/bcrypt/lib/binding/bcrypt_lib.node'
11/20/2018 6:29:11 PM was compiled against a different Node.js version using
11/20/2018 6:29:11 PM NODE_MODULE_VERSION 64. This version of Node.js requires
11/20/2018 6:29:11 PM NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
11/20/2018 6:29:11 PM the module (for instance, using `npm rebuild` or `npm install`).
11/20/2018 6:29:11 PM at Object.Module._extensions..node (module.js:682:18)
11/20/2018 6:29:11 PM at Module.load (module.js:566:32)
11/20/2018 6:29:11 PM at tryModuleLoad (module.js:506:12)
11/20/2018 6:29:11 PM at Function.Module._load (module.js:498:3)
11/20/2018 6:29:11 PM at Module.require (module.js:597:17)
11/20/2018 6:29:11 PM at require (internal/module.js:11:18)
11/20/2018 6:29:11 PM at Object.<anonymous> (/app/node_modules/bcrypt/bcrypt.js:6:16)
11/20/2018 6:29:11 PM at Module._compile (module.js:653:30)
11/20/2018 6:29:11 PM at Object.Module._extensions..js (module.js:664:10)
11/20/2018 6:29:11 PM at Module.load (module.js:566:32)
11/20/2018 6:29:11 PM at tryModuleLoad (module.js:506:12)
11/20/2018 6:29:11 PM at Function.Module._load (module.js:498:3)
11/20/2018 6:29:11 PM at Module.require (module.js:597:17)
11/20/2018 6:29:11 PM at require (internal/module.js:11:18)
11/20/2018 6:29:11 PM at Object.<anonymous> (/app/dist/db/models/Users.js:46:14)
11/20/2018 6:29:11 PM at Module._compile (module.js:653:30)
11/20/2018 6:29:11 PM error Command failed with exit code 1.
11/20/2018 6:29:11 PM info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
IMHO, Build step is completely unrelated to testing pipelines? And it’s using completely unrelated dockerfile for this purpose. Or am I wrong?
Any idea?