graphql-faker icon indicating copy to clipboard operation
graphql-faker copied to clipboard

Usage with Docker; specifying a schema file name

Open lameimpala opened this issue 5 years ago • 3 comments

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.

lameimpala avatar Feb 10 '20 00:02 lameimpala

@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

IvanGoncharov avatar Feb 10 '20 09:02 IvanGoncharov

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

mschipperheyn avatar Feb 14 '20 21:02 mschipperheyn

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

robsontenorio avatar Feb 24 '21 00:02 robsontenorio