Merge pull request #76 from there4/feat-build-docker-image

feat: Add docker build
This commit is contained in:
Benedikt Franke 2018-03-14 22:07:23 +01:00 committed by GitHub
commit f9e5f5e2dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 34 deletions

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
# Utilize multi-stage build to keep image size down
FROM composer as composer
COPY composer.* ./
RUN composer install --no-dev --optimize-autoloader --no-progress --no-suggest
# Build the actual image
FROM php
RUN apt-get update \
&& apt-get install -qqy --no-install-recommends\
# This is for enabling the program to be run with watch
procps \
wkhtmltopdf \
# Required to run PDF generation
xvfb \
xauth \
&& rm -rf /var/lib/apt/lists/*
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

View File

@ -1,4 +1,5 @@
# Markdown Resume Generator [![Build Status](https://travis-ci.org/there4/markdown-resume.png?branch=master)](https://travis-ci.org/there4/markdown-resume) # Markdown Resume Generator [![Build Status](https://travis-ci.org/there4/markdown-resume.png?branch=master)](https://travis-ci.org/there4/markdown-resume)
[![nodesource/node](http://dockeri.co/image/there4/markdown-resume)](https://registry.hub.docker.com/u/there4/markdown-resume/)
> Convert markdown to HTML and PDF resumes > Convert markdown to HTML and PDF resumes
Turn a simple Markdown document into an elegant resume with both a perfect Turn a simple Markdown document into an elegant resume with both a perfect
@ -14,38 +15,42 @@ at the [blog post for the project][blog], or look in examples/output to see samp
* Single file deployment (no external stylesheets) * Single file deployment (no external stylesheets)
* You can now version control and branch your resume. * You can now version control and branch your resume.
## Install ## Installation
### Docker
Run this in the directory where you put your markdown resume:
`docker run -it -v ${PWD}:/resume there4/markdown-resume bash`
In the docker console, you can run `md2resume` on your files.
For PDF conversion, run `md2pdf` instead of the usual command.
### Local
1. Clone the repo `git clone git@github.com:there4/markdown-resume.git` or [Download ZIP](https://github.com/there4/markdown-resume/archive/master.zip)
2. **PHP 7** and **[composer](https://getcomposer.org/download/)** are installed and on your PATH
3. `composer install` inside of the project directory to install dependencies
4. For generating PDF files, you need to install `wkhtmltopdf`
* OSX: `brew cask install wkhtmltopdf` via [Homebrew Cask](https://caskroom.github.io/)
* Debian: `sudo apt install php7.0-mbstring wkhtmltopdf`
* Fedora `sudo dnf install php-mbstring wkhtmltopdf`
## Usage
The two most important commands are the following two. Run them
inside the cloned directory
#### OSX
1. The simplest installation of the PDF to HTML conversion tool is via [Homebrew Cask](https://caskroom.github.io/)
```bash ```bash
brew cask install wkhtmltopdf ./bin/md2resume html examples/source/sample.md examples/output/
``` ./bin/md2resume pdf examples/source/sample.md examples/output/
2. Download as .zip (cloning has [an issue as of Dec 2017](https://github.com/there4/markdown-resume/issues/65)) and unzip.
3. [Install PHP 7](https://jason.pureconcepts.net/2016/09/upgrade-php-mac-os-x/) and be sure to update your PATH variable.
4. [Install 'composer'](https://getcomposer.org/download/), a per-project package installer to setup the rest of the requirements. You may need to run './composer.phar update' to get the correct versions of dependencies.
5. Now you should be ready to continue down in Quickstart.
#### Debian
```bash
sudo apt install php7.0-mbstring wkhtmltopdf
```
#### Fedora
```bash
sudo dnf install php-mbstring wkhtmltopdf
```
## Quickstart
```
./bin/md2resume html examples/source/sample.md examples/output/
./bin/md2resume pdf examples/source/sample.md examples/output/
``` ```
## Help ## Help
``` ```
Markdown Resume Generator version 2.2.1 by Craig Davis Markdown Resume Generator version 2.3.0 by Craig Davis
Usage: Usage:
[options] command [arguments] [options] command [arguments]
@ -69,25 +74,25 @@ Available commands:
version Show current version information version Show current version information
``` ```
## Examples ## Examples
Choose a template with the -t option. Choose a template with the -t option.
```
`./bin/md2resume html --template blockish examples/source/sample.md examples/output/` ./bin/md2resume html --template blockish examples/source/sample.md examples/output/`
```
If you want to edit your markdown resume in your editor while watching it If you want to edit your markdown resume in your editor while watching it
update in your browser, run this command: update in your browser, run this command:
```
`watch ./bin/md2resume html --refresh yes --template modern examples/source/sample.md examples/output/` watch ./bin/md2resume html --refresh yes --template modern examples/source/sample.md examples/output/
```
This makes the build script run periodically, and html document will refresh This makes the build script run periodically, and html document will refresh
every two seconds via a meta tag. Open the `./examples/ouput/sample.html` file every two seconds via a meta tag. Open the `./examples/ouput/sample.html` file
in your browser, and then just save your markdown document when you want to see in your browser, and then just save your markdown document when you want to see
a fresh preview. a fresh preview.
For information about running this inside a Docker container, please read [Issue 46](https://github.com/there4/markdown-resume/issues/46#issuecomment-126520792)
where [Sebastian Klose](https://github.com/sklose) has shared his approach.
## Authoring Your Resume ## Authoring Your Resume
Markdown is limited to basic html markup. Follow the `examples/source/sample.md` Markdown is limited to basic html markup. Follow the `examples/source/sample.md`
@ -98,6 +103,7 @@ we have very few ways to nest or identify elements that many of the css rules
are based on descendant and adjacent selectors. are based on descendant and adjacent selectors.
## Feature Development ## Feature Development
In order to add new commands, you'll need to first install the dependencies: In order to add new commands, you'll need to first install the dependencies:
* `composer install` * `composer install`
@ -106,7 +112,7 @@ After that, you can run the `md2resume_dev.php` file from the command line.
## Building a Release ## Building a Release
1. Tag the repo with the new build number. 1. Tag the repo with the new build number.
2. Run `composer build`. 2. Run `composer build`.
3. Push both the tag and the code. 3. Push both the tag and the code.
@ -119,6 +125,7 @@ are a more comfortable with html than markdown, you should use it.
## Changelog ## Changelog
* __2.3.0__ : Add docker support to ease the installation process [@spawnia](https://github.com/spawnia)
* __2.2.0__ : Dropped phar file distribution, removed Pake and migrated to composer commands * __2.2.0__ : Dropped phar file distribution, removed Pake and migrated to composer commands
* __2.1.0__ : Dropped PHP5 support * __2.1.0__ : Dropped PHP5 support
* __2.0.12__ : Added new `Roboto` template from [@ejwaibel](https://github.com/ejwaibel) * __2.0.12__ : Added new `Roboto` template from [@ejwaibel](https://github.com/ejwaibel)

View File

@ -36,6 +36,11 @@
"name": "Erik Waibel", "name": "Erik Waibel",
"email": "ejwaibel@gmail.com", "email": "ejwaibel@gmail.com",
"role": "Contributor" "role": "Contributor"
},
{
"name": "Benedikt Franke",
"email": "benedikt@franke.tech",
"role": "Contributor"
} }
], ],
"support": { "support": {