Skip to content

Commit d56f500

Browse files
committed
Add docker support
1 parent 4bdfdb5 commit d56f500

File tree

5 files changed

+62
-18
lines changed

5 files changed

+62
-18
lines changed

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM ubuntu:22.10
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
RUN apt-get update && \
6+
# Set timezone
7+
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \
8+
apt-get install -y tzdata && \
9+
dpkg-reconfigure --frontend noninteractive tzdata && \
10+
# Install `pandoc` and `markdownlint`
11+
apt-get install make pandoc ruby texlive-xetex --yes && \
12+
gem install mdl
13+
14+
COPY Makefile /repo/
15+
COPY USAGE.md /repo/
16+
COPY README.md /repo/
17+
18+
RUN mkdir /repo/artifacts
19+
20+
WORKDIR /repo

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
.DEFAULT_GOAL := all
22

33
INPUT_FILE = README.md
4-
OUTPUT_FILE = artifacts/python-for-coding-interview.pdf
4+
USAGE_FILE = USAGE.md
5+
OUTPUT_DIR = artifacts
6+
OUTPUT_FILE = $(OUTPUT_DIR)/python-for-coding-interview.pdf
57

68
.PHONY: linter
79
linter:
8-
markdownlint $(INPUT_FILE) --disable MD013 MD025
10+
mdl -r ~MD013 "$(INPUT_FILE)"
11+
mdl -r ~MD013 "$(USAGE_FILE)"
912

1013
.PHONY: pdf
1114
pdf:
12-
pandoc $(INPUT_FILE) \
15+
mkdir -p "$(OUTPUT_DIR)"
16+
pandoc "$(INPUT_FILE)" \
1317
--pdf-engine=xelatex \
1418
-M date="`date "+%B%e, %Y"`" \
15-
-o $(OUTPUT_FILE)
19+
-o "$(OUTPUT_FILE)"
1620

1721
.PHONY: all
1822
all: linter pdf

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ Additional material:
2020

2121
## Topics
2222

23-
1. [Primitive Types](#primitive-types).
24-
1. [Tuples](#tuples).
25-
1. [Lists](#lists).
26-
1. [Strings](#strings).
27-
1. [Stacks](#stacks).
28-
1. [Queues](#queues).
29-
1. [Sets](#sets).
30-
1. [Hash Tables](#hash-tables).
31-
1. [Heaps](#heaps).
32-
1. [Collections](#collections):
33-
1. [namedtuple](#collectionsnamedtuple).
34-
1. [defaultdict](#collectionsdefaultdict).
35-
1. [Counter](#collectionscounter).
36-
1. [OrderedDict](#collectionsordereddict).
23+
1. [Primitive Types](#primitive-types)
24+
1. [Tuples](#tuples)
25+
1. [Lists](#lists)
26+
1. [Strings](#strings)
27+
1. [Stacks](#stacks)
28+
1. [Queues](#queues)
29+
1. [Sets](#sets)
30+
1. [Hash Tables](#hash-tables)
31+
1. [Heaps](#heaps)
32+
1. [Collections](#collections)
33+
1. [namedtuple](#collectionsnamedtuple)
34+
1. [defaultdict](#collectionsdefaultdict)
35+
1. [Counter](#collectionscounter)
36+
1. [OrderedDict](#collectionsordereddict)
3737

3838
## Primitive Types
3939

USAGE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Usage
2+
3+
## With docker
4+
5+
```text
6+
docker build -t pfci:latest .
7+
# Linter
8+
docker run --rm pfci:latest make linter
9+
# Generate PDF
10+
docker run --rm -v %cd%\artifacts:/repo/artifacts pfci:latest make pdf
11+
```
12+
13+
docker run --rm pfci:latest "make pdf &> /dev/null && ls /repos/" > ./artifacts/python-for-coding-interview.pdf
14+
15+
## Without docker
16+
17+
```text
18+
make linter
19+
make pdf
20+
```
-209 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)