forked from Paperist/texlive-ja
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
48 lines (39 loc) · 1.07 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
USERNAME=wsuzume
SOURCE=Dockerfile
IMAGE=${USERNAME}/alpine-texlive:latest
CONTAINER=alpine-texlive
ifeq ($(OS),Windows_NT)
PWD=$(CURDIR)
endif
# build container image
.PHONY: build
build: Dockerfile
docker image build -f ${SOURCE} -t ${IMAGE} .
# pull image
.PHONY: pull
pull:
docker pull wsuzume/alpine-texlive:latest
# create new container and login to the shell
.PHONY: shell
shell:
docker container run -it --rm -v ${PWD}/workdir:/workdir ${IMAGE}
# clean up all stopped containers
.PHONY: clean
clean:
docker container prune
# delete all image
.PHONY: doomsday
doomsday:
docker image rm -f `docker image ls -q`
# sample
## target file is workdir/${XXDIR}/${XXMAIN}.tex
SAMPLEDIR=sample
SAMPLEMAIN=main
# uncomment if you want to compile with platex
#SAMPLEARG=-latex=platex
sample: workdir/sample/${SAMPLEMAIN}.tex
docker container run -it --rm \
-v ${PWD}/workdir:/workdir \
-w /workdir/${SAMPLEDIR} \
${IMAGE} \
sh -c "mktexlsr && latexmk -C ${SAMPLEMAIN}.tex && latexmk ${SAMPLEARG} ${SAMPLEMAIN}.tex && dvipdfmx ${SAMPLEMAIN}.dvi && latexmk -c ${SAMPLEMAIN}.tex"