Comments (4)
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.
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) orC:\Users
(Windows) directory - and so you can mount files or directories usingdocker run -v /Users/<path>:/<container path> ...
(OS X) ordocker 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.
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.
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)
- PDF output is tiny HOT 4
- Project is unlicensed HOT 4
- Please run `composer install` to install dependencies HOT 7
- Links strangely generated HOT 1
- README has incorrect instructions HOT 1
- Running ./bin/md2resume results in error message - Linux HOT 4
- Running `composer install` doesn't produce md2resume_dev.php file HOT 2
- Usage with Docker HOT 2
- Trailing spaces required for linebreak HOT 2
- The dependency '' was not found. Please run `composer install` to install dependencies. HOT 3
- Generating a PDF results in a non A4 format HOT 3
- Repo clone command fails HOT 1
- More documentation on how to use this with Docker HOT 4
- How to run development build inside Docker container? HOT 1
- Newest commit breaks modern template HOT 2
- Invalid template HOT 2
- Fix version of wkhtml from Dockerfile
- Add docker-compose.yml to allow for more customizable Docker environment
- Using the tool as of march 2022: configuration drift in Dockerfile
- chinese failed. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdown-resume.