ci: GitLab pipeline for the cv-builder image.

This is the first of a few commits for creating
the GitLab CI pipeline for building and publishing my CV.
This commit adds a pipeline for building and publishing the cv-builder
docker image to the GitLab container registry.

Additions:

- The cv-builder docker image: This commit adds a Dockerfile for
building the cv-builder docker image. The image is based on the
golang (buster) image and installs ConTeXt (standalone version)
and the Carlito font.

- The gitlab-ci.yml file: This commit adds the gitlab-ci.yml file for
running the pipeline for building and publishing the docker image
to the GitLab Container Registry.

Changes:

- The Makefile now includes targets for building and publishing docker images.
This commit is contained in:
Dan Anglin 2019-12-21 19:38:34 +00:00
parent 3b69a589fd
commit 5fbdaa5a02
No known key found for this signature in database
GPG key ID: 7AC2B18EC1D09F27
4 changed files with 86 additions and 1 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
*

47
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,47 @@
---
stages:
- test
- build
- publish
variables:
IMAGE_NAME: ${CI_REGISTRY}/${CI_PROJECT_PATH}/cv-builder
IMAGE_TAG: ${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}
services:
- docker:19.03.5-dind
.use-docker:
image: docker:19.03.5
.install-deps: &install-deps
- apk add --no-cache make
test:docker-image:
extends: .use-docker
script:
- *install-deps
- make image
stage: test
only:
changes:
- docker/Dockerfile
except:
refs:
- master
publish:docker-image:
extends: .use-docker
before_script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
after_script:
- docker logout ${CI_REGISTRY}
script:
- *install-deps
- make publish
stage: publish
only:
changes:
- docker/Dockerfile
refs:
- master@dananglin/cv

View file

@ -1,9 +1,18 @@
DOCKERFILE = ./docker/Dockerfile
IMAGE_NAME ?= cv-builder
IMAGE_TAG ?= latest
OUTPUT_DIR = __output/
.PHONY: all tex pdf clean
.PHONY: all image publish tex pdf clean
all: pdf
image:
@docker build -f $(DOCKERFILE) -t $(IMAGE_NAME):$(IMAGE_TAG) .
publish: image
@docker push $(IMAGE_NAME):$(IMAGE_TAG)
tex:
@go run .

28
docker/Dockerfile Normal file
View file

@ -0,0 +1,28 @@
FROM golang:1.13.5-buster
# Upgrade packages and install dependencies
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
fonts-crosextra-carlito \
rsync \
&& \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* /tmp/*
# Install ConTeXt standalone
RUN \
mkdir /opt/context && \
cd /opt/context && \
curl -LO http://minimals.contextgarden.net/setup/first-setup.sh && \
sh ./first-setup.sh \
--context=current \
--engine=luatex \
&& \
rm -rf /opt/context/tex/texmf-context/doc
ENV PATH=${PATH}:/opt/context/tex/texmf-linux-64/bin \
OSFONTDIR=/usr/share/fonts
RUN mtxrun --script fonts --reload