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

docker: Define ENTRYPOINT as absolute path #1684

Merged
merged 2 commits into from
Sep 2, 2022

Conversation

110y
Copy link
Contributor

@110y 110y commented Sep 2, 2022

What

  • Use an absolute path for Dockerfile ENTRYPOINT

Why

I'm running up apollographql/router by Docker Compose for my local development. And, I'm changing the working directory for the router image like below in order to mount my application repository:

---
version: "3.8"

services:
  router:
    image: ghcr.io/apollographql/router:v1.0.0-alpha.0
    volumes:
      - .:/workspace:cached
    working_dir: /workspace
    command: --config router.yaml --supergraph schema.graphql

Since the current Dockerfile specifies a relative path (./router) for ENTRYPOINT, changing the working directory causes an error

Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "./router": stat ./router: no such file or directory: unknown

Though I know specifying entrypoint: /dist/router to my docker-compose.yml fixes the problem, it requires users of the router image to recognize the working directory of the image (/dist) to do so, and I think it's not user friendly.
So, I created this PR that changes ENTRYPOINT from a relative ./router to an absolute /dist/router.

@apollo-cla
Copy link

@110y: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

@110y 110y force-pushed the fix-dockerfiles-entrypoint branch from 30353c0 to 0cad36c Compare September 2, 2022 05:55
Copy link
Member

@abernix abernix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right — thanks! This was a result of me trying to DRY things up, but thank you.

:shipit:

@abernix
Copy link
Member

abernix commented Sep 2, 2022

Hope you don't mind, I added a change log entry for you!

@abernix abernix added this to the v1.0.0-alpha.1 milestone Sep 2, 2022
@abernix abernix changed the title Use an absolute path for Dockerfile ENTRYPOINT docker: Define ENTRYPOINT as absolute path Sep 2, 2022
@abernix abernix merged commit 4088929 into apollographql:main Sep 2, 2022
@abernix abernix mentioned this pull request Sep 2, 2022
@110y 110y deleted the fix-dockerfiles-entrypoint branch September 2, 2022 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants