Enable pdf conversion as a oneshot command in docker
This commit is contained in:
parent
61524c1702
commit
8dd29e5afd
15
Dockerfile
15
Dockerfile
|
@ -6,6 +6,9 @@ RUN composer install --no-dev --optimize-autoloader --no-progress --no-suggest
|
|||
# Build the actual image
|
||||
FROM php
|
||||
|
||||
WORKDIR /resume
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -qqy --no-install-recommends\
|
||||
# This is for enabling the program to be run with watch
|
||||
|
@ -16,11 +19,15 @@ RUN apt-get update \
|
|||
xauth \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Wrap pdf creation in a xvfb-run to enable headless pdf creation in the container
|
||||
RUN printf '#!/bin/bash\nexec xvfb-run md2resume pdf "$@"' >> /usr/bin/md2pdf \
|
||||
&& chmod +x /usr/bin/md2pdf
|
||||
|
||||
# Enables continously calling a command and piping the output to STDOUT, viewable via docker logs
|
||||
RUN printf '#!/bin/bash\nwhile sleep 1; do\n "$@"\ndone' >> /usr/bin/watch-docker \
|
||||
&& chmod +x /usr/bin/watch-docker
|
||||
|
||||
COPY --from=composer /app/vendor /app/vendor
|
||||
COPY . /app
|
||||
|
||||
RUN ln -s /app/bin/md2resume /usr/bin/md2resume
|
||||
|
||||
RUN echo "alias md2pdf=\"xvfb-run md2resume pdf\"" >> ~/.bashrc
|
||||
|
||||
WORKDIR /resume
|
||||
|
|
17
README.md
17
README.md
|
@ -19,12 +19,21 @@ at the [blog post for the project][blog], or look in examples/output to see samp
|
|||
|
||||
### Docker
|
||||
|
||||
Run this in the directory where you put your markdown resume:
|
||||
Run those commands in the directory where you put your markdown resume.
|
||||
|
||||
`docker run -it -v ${PWD}:/resume there4/markdown-resume bash`
|
||||
The command for PDF creation works differently in a container, use `md2pdf` instead of the usual command.
|
||||
|
||||
In the docker console, you can run `md2resume` on your files.
|
||||
For PDF conversion, run `md2pdf` instead of the usual command.
|
||||
#### Oneshot command
|
||||
|
||||
This is best suited for use in scripts or in CI environments:
|
||||
|
||||
`docker run -v ${PWD}:/resume there4/markdown-resume md2resume [options] command [arguments]`
|
||||
|
||||
#### Interactive console
|
||||
|
||||
This allows you to enter an interactive console where you can easily experiment and run different commands:
|
||||
|
||||
`docker run -it -v ${PWD}:/resume there4/markdown-resume`
|
||||
|
||||
### Local
|
||||
|
||||
|
|
Loading…
Reference in New Issue