Git Product home page Git Product logo

Comments (4)

sklose avatar sklose commented on July 19, 2024 2

I finally found a way to do it, in case somebody else is interested:

Dockerfile

FROM php:5-cli
VOLUME /out
ENV DEBIAN_FRONTEND noninteractive
RUN docker-php-ext-install mbstring
RUN apt-get update && apt-get -qqy install wget wkhtmltopdf
RUN wget https://github.com/there4/markdown-resume/raw/master/bin/md2resume && chmod +x md2resume
CMD ./md2resume html /out/sklose.md /out/html && ./md2resume pdf /out/sklose.md /out/pdf

Bash scrip to run everything:

#!/bin/bash
docker build -t sklose/resume .
mkdir -p html
mkdir -p pdf
xhost + # this is required for the conatiner to access our local X-Server
docker run --rm -t -i -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro -v $PWD:/out:rw sklose/resume
sudo chown -R sebastian .
xhost -

from markdown-resume.

artem-frolov avatar artem-frolov commented on July 19, 2024 1

Thanks, @sklose!
There is an easier way that can be used on any OS including Windows and Mac OS.

Dockerfile

FROM php:5-cli
VOLUME /out
ENV DEBIAN_FRONTEND noninteractive
RUN docker-php-ext-install mbstring
RUN apt-get update && apt-get -qqy install wget wkhtmltopdf xvfb
RUN wget https://github.com/there4/markdown-resume/raw/master/bin/md2resume && chmod +x md2resume
CMD ./md2resume html /out/resume.md /out/html && xvfb-run ./md2resume pdf /out/resume.md /out/pdf

Bash script

#!/bin/bash
docker build -t your/resume .
mkdir -p html
mkdir -p pdf
docker run --rm -t -i -e DISPLAY -v $PWD:/out:rw your/resume
sudo chown -R youruser .

Windows/Mac OS users, keep in mind the following note from the Docker user guide:

If you are using Docker Machine on Mac or Windows, your Docker daemon only has limited access to your OS X/Windows filesystem. Docker Machine tries to auto-share your /Users (OS X) or C:\Users (Windows) directory - and so you can mount files or directories using docker run -v /Users/<path>:/<container path> ... (OS X) or docker run -v /c/Users/<path>:/<container path ... (Windows). All other paths come from your virtual machine’s filesystem.

So on Windows docker run --rm -t -i -e DISPLAY -v $PWD:/out:rw your/resume should look like docker run --rm -t -i -e DISPLAY -v /c/Users/youruser/resumedir/:/out:rw your/resume

from markdown-resume.

craig-davis avatar craig-davis commented on July 19, 2024

I would guess that the webkit tooling (wkhtmltopdf) is trying to connect to a display. I'm not sure if wkhtmltopdf supports running in a headless mode. I'd start by investigating that. Let me know what you find!

from markdown-resume.

craig-davis avatar craig-davis commented on July 19, 2024

Thanks! This is great information to have. I really appreciate you taking the time to share it. I'll add this to the docs.

from markdown-resume.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.