initial scripts

This commit is contained in:
Gojko Adzic 2019-05-23 11:39:12 +02:00
commit 3675c40ee7
4 changed files with 93 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
result
build
cache

34
Makefile Normal file
View File

@ -0,0 +1,34 @@
PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
DOCKER_IMAGE ?= lambci/lambda-base-2:build
TARGET ?=/opt/
MOUNTS = -v $(PROJECT_ROOT):/var/task \
-v $(PROJECT_ROOT)result:$(TARGET) \
-v $(PROJECT_ROOT)cache:/usr/local
DOCKER = docker run -it --rm -w=/var/task/build
build result cache:
mkdir $@
clean:
rm -rf build result cache
bash:
$(DOCKER) $(MOUNTS) --entrypoint /bin/bash -t $(DOCKER_IMAGE)
all result/bin/x86_64-linux/latex: build result cache
$(DOCKER) $(MOUNTS) --entrypoint /usr/bin/make -t $(DOCKER_IMAGE) TARGET_DIR=$(TARGET) -f ../Makefile_Latex $@
STACK_NAME ?= latex-layer
build/output.yaml: template.yaml result/bin/x86_64-linux/latex
aws cloudformation package --template $< --s3-bucket $(DEPLOYMENT_BUCKET) --output-template-file $@
deploy: build/output.yaml
aws cloudformation deploy --template $< --stack-name $(STACK_NAME)
aws cloudformation describe-stacks --stack-name $(STACK_NAME) --query Stacks[].Outputs --output table
deploy-example:
cd example && \
make deploy DEPLOYMENT_BUCKET=$(DEPLOYMENT_BUCKET) LATEX_STACK_NAME=$(STACK_NAME)

37
Makefile_Latex Normal file
View File

@ -0,0 +1,37 @@
PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
CACHE_DIR=$(PROJECT_ROOT)build/cache
.ONESHELL:
### step 1: texlive installer
# see https://www.tug.org/texlive/acquire-netinstall.html
TEXLIVE_SOURCE=install-tl-unx.tar.gz
$(TEXLIVE_SOURCE):
curl -LO http://mirror.ctan.org/systems/texlive/tlnet/$(TEXLIVE_SOURCE)
/usr/lib64/perl5/vendor_perl/Digest/MD5.pm:
yum install perl-Digest-MD5 -y
# see https://wiki.archlinux.org/index.php/TeX_Live
TLMGR=/opt/texlive/bin/x86_64-linux/tlmgr
$(TLMGR): $(TEXLIVE_SOURCE) /usr/lib64/perl5/vendor_perl/Digest/MD5.pm
tar xf $<
cd install-tl*
./install-tl --profile $(PROJECT_ROOT)texlive.profile
## see https://pandoc.org/MANUAL.html
pandoc-packages: $(TLMGR)
$(TLMGR) install xcolor amsfonts amsmath lm unicode-math \
ifxetex ifluatex listings fancyvrb longtable booktabs \
graphicx grffile hyperref xcolor ulem geometry \
setspace babel upquote microtype parskip xurl \
bookmark footnotehyper footnote
all: $(TLMGR) pandoc-packages
pandoc-xelatex-packages:
$(TLMGR) fontspec polyglossia xecjk bidi mathspec upquote microtype \
csquotes natbib biblatex bibtex biber

19
texlive.profile Normal file
View File

@ -0,0 +1,19 @@
selected_scheme scheme-custom
TEXDIR /opt/texlive
TEXMFSYSCONFIG /opt/texlive/texmf-config
TEXMFSYSVAR /opt/texlive/texmf-var
TEXMFLOCAL /opt/texlive/texmf-local
TEXMFHOME /tmp/texmf
TEXMFCONFIG /tmp/texmf-config
TEXMFVAR /tmp/texmf-var
collection-basic 1
collection-latex 1
tlpdbopt_autobackup 0
tlpdbopt_backupdir tlpkg/backups
tlpdbopt_create_formats 0
tlpdbopt_desktop_integration 0
tlpdbopt_file_assocs 0
tlpdbopt_generate_updmap 0
tlpdbopt_install_docfiles 0
tlpdbopt_install_srcfiles 0
tlpdbopt_post_code 1