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

add dockerfile/example to ease usage #55

Closed
babaorum opened this issue Jun 18, 2021 · 3 comments
Closed

add dockerfile/example to ease usage #55

babaorum opened this issue Jun 18, 2021 · 3 comments

Comments

@babaorum
Copy link

I created the following dockerfile to test this project

FROM alpine:3.13

RUN apk add --no-cache curl

WORKDIR /app

RUN curl -o graph-composer -L https://clue.engineering/graph-composer-latest.phar && chmod +x graph-composer

FROM php:8.0-cli-alpine

COPY --from=0 /app/graph-composer /usr/local/bin/graph-composer

RUN sed -i '/edge/s/^#//' /etc/apk/repositories \
    && apk add --no-cache graphviz

WORKDIR /app

ENTRYPOINT ["/usr/local/bin/graph-composer"]

Would you be interested in connecting it to your project in any way ? It can of course be modified.

@patricknelson
Copy link

I actually just happened to build this myself. It's already on Docker Hub if you want to use it right now:

# Generic (replace LOCAL_PATH)
docker run -it --rm -v LOCAL_PATH:/graph-composer patricknelson/graph-composer-docker sh

# ... then run graph-composer.phar as usual...
graph-composer.phar export > graph.svg

I'm lazy, so I have some shortcuts for LOCAL_PATH 😄

# Relative to current directory (MacOS/Linux)
docker run -it --rm -v "$(pwd):/graph-composer" patricknelson/graph-composer-docker sh

# Relative to current directory (Windows with cygwin)
docker run -it --rm -v "$(cygpath -am .):/graph-composer" patricknelson/graph-composer-docker sh

p.s. That version above may not work for binary formats like PNG since the fonts cannot be rendered without the ttf-freefont package also present in the container (I tried in mine and just got squares/boxes). See my Dockerfile.

@clue
Copy link
Owner

clue commented Dec 30, 2021

@babaorum @patricknelson Thank you for providing your Dockerfile / Docker image!

This sure looks like a good starting point if you want to use graph-composer within a Docker container. I agree that providing this especially for the graph-composer export command can make a lot of sense, but I wonder how much sense the graph-composer show command makes within a container.

I don't think there's anything else that needs to be done in this repository, except perhaps adding a link to the README somewhere? PRs are very much welcome!

I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can always reopen this 👍

@clue clue closed this as completed Dec 30, 2021
@patricknelson
Copy link

Thanks by the way for making this tool! 😄

Right. I guess my main issue was encapsulating the various dependencies (basically just graphviz and ttf-freefont) and then allowing me to run whatever version of PHP I needed in order to be relatively consistent with (or even isolated from) the actual application install, depending on the situation. Plus, running PHP on my host machine is never something I do anymore (everything is containerized or at least virtualized).

Of course in those situations, the show command will not work considering those types of environments are highly unlikely to have any sort of GUI or desktop environment installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants