Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base container image has a collections.json directory that messes up custom container builds #12

Closed
Bak3y opened this issue May 26, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Bak3y
Copy link

Bak3y commented May 26, 2022

Expected Behavior

Copying a collection.json file to the working directory of the base image and building a new image should result in a functional container image with a working test.

Actual Behavior

After copying collection.json into the working directory and running the container, the app throws a stack trace:

### 2022-05-26 15:59 Starting run of ./collection.json
node:internal/modules/cjs/loader:933
  const err = new Error(message);
              ^

Error: Cannot find module './collection.json'
Require stack:
- /runner/server.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at runCollection (/runner/server.js:157:19)
    at Server.<anonymous> (/runner/server.js:132:3)
    at Object.onceWrapper (node:events:509:28)
    at Server.emit (node:events:390:28)
    at emitListeningNT (node:net:1368:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/runner/server.js' ]
}

Steps to Reproduce the Problem

  1. Create a Dockerfile like so:
FROM ghcr.io/benc-uk/postman-prometheus
COPY ./collection.json ./collection.json
  1. Build the dockerfile: docker build . -t postman-test:1 -f Dockerfile
  2. Run the container: docker run postman-test:1

Environment Details

  • Operating System: MacOS 12.4
  • Platform: Docker version 20.10.14, build a224086

Workaround

If your do this in your Dockerfile, things work as expected:

FROM ghcr.io/benc-uk/postman-prometheus
RUN rm -rf ./collection.json
COPY ./collection.json ./collection.json
@Bak3y Bak3y added the bug Something isn't working label May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant