add dockerfile/example to ease usage
babaorum opened this issue ยท 3 comments
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.
I actually just happened to build this myself. It's already on Docker Hub if you want to use it right now:
- Docker Hub: https://hub.docker.com/r/patricknelson/graph-composer-docker
- Source: https://github.com/patricknelson/graph-composer-docker
# 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.
@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 ๐
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.