aboutsummaryrefslogtreecommitdiff
blob: d084d2e94df11dabecd08b797d5883a08105365a (plain)
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
#!/bin/bash
set -e
TRACE=${TRACE:=0}
[[ $TRACE -eq 1 ]] && set -x
IMAGE_NAME=docker.gentoo.org/sites/www
IMAGE_TAG=latest
IMAGE=${IMAGE_NAME}:${IMAGE_TAG}
IMAGE_SRC=docker/

docker_build() {
	# Always refresh the image
	# Docker caches it anyway
	docker build \
		--quiet \
		-t "${IMAGE}" \
		"${IMAGE_SRC}"
}

_docker_run_common() {
	docker run \
		--rm \
		-e JEKYLL_UID="$(id -u)" \
		-e JEKYLL_GID="$(id -g)" \
		--volume="${PWD}:/srv/jekyll" \
		"$@"
}

docker_run_net_host() {
	_docker_run_common \
		--net=host \
		"${IMAGE}" \
	"$@"
}

docker_run_net_none() {
	_docker_run_common \
		--net=none \
		"${IMAGE}" \
	"$@"
}