graphql-kit / graphql-faker

🎲 Mock or extend your GraphQL API with faked data. No coding required.
MIT License
2.69k stars 225 forks source link

Usage with Docker; specifying a schema file name #93

Open lameimpala opened 4 years ago

lameimpala commented 4 years ago

Maybe I'm an idiot, but I can't get graphql-faker to pickup the schema file while running in docker. The only workaround I found is to name the mounted schema file exactly as the default: graphql-faker.

IvanGoncharov commented 4 years ago

@lameimpala I have zero knowledge of Docker so it can be a case that I broke something. Just to be sure, you tried this line from README? https://github.com/APIs-guru/graphql-faker#usage-with-docker

docker run -v=${PWD}:/workdir apisguru/graphql-faker path/to/schema.sdl

mschipperheyn commented 4 years ago

@IvanGoncharov I answered your question as part of a question I put https://github.com/APIs-guru/graphql-faker/issues/94

robsontenorio commented 3 years ago

For future reference...

Here is a setup for GITLAB gitlab-ci.yml

So http://my-faker-server:9002/graphql will be available on tests.

Note that /builds/your-repo-name is that default base path from gitlab, then path/to/schema/fake.graphql refers to relative path on project.

phpunit:
  stage: test
  services:
    - name: apisguru/graphql-faker:latest
      alias: my-faker-server
      entrypoint: ["node", "/usr/local/bin/graphql-faker", "/builds/your-repo-name/path/to/schema/fake.graphql"]
  script:
    - composer test

And local development with docker-compose.yml

So http://my-faker-server:9002/graphql will be available on tests.

my-faker-server:
    image: apisguru/graphql-faker:latest
    command: "fake.graphql"
    volumes:
      - /local/path/to/fake.graphql:/workdir
    ports:
      - 9002:9002