forked from rstudio/rstudio-docker-products
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
79 lines (63 loc) · 2.31 KB
/
Justfile
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
set positional-arguments
BUILDX_PATH := ""
PRODUCT := "product-base-pro"
IMAGE_OS := "ubuntu1804"
IMAGE_REGISTRY := "rstudio"
R_VERSION := "4.1.0"
R_VERSION_ALT := "3.6.2"
PYTHON_VERSION := "3.9.5"
PYTHON_VERSION_ALT := "3.8.10"
TINI_VERSION := "0.19.0"
QUARTO_VERSION := "1.1.251"
DRIVERS_VERSION := "2022.11.0"
DRIVERS_VERSION_RHEL := DRIVERS_VERSION + "-1"
_make-default-tag OS=IMAGE_OS:
echo "{{IMAGE_REGISTRY}}/{{PRODUCT}}:{{OS}}-r{{R_VERSION}}_{{R_VERSION_ALT}}-py{{PYTHON_VERSION}}_{{PYTHON_VERSION_ALT}}"
# Build base pro image - just build ubuntu1804 rstudio/product-base-pro:ubuntu1804
build OS=IMAGE_OS *TAGS="":
#!/usr/bin/env bash
set -euxo pipefail
BUILDX_ARGS=""
if [[ "{{BUILDX_PATH}}" != "" ]]; then
BUILDX_ARGS="--cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache"
fi
if [[ "{{TAGS}}" == "" ]]; then
raw_tag_array=($(just _make-default-tag {{OS}}))
else
raw_tag_array=("{{TAGS}}")
fi
if [[ "{{ OS }}" == "centos7" ]]; then
_DRIVERS_VERSION="{{ DRIVERS_VERSION_RHEL }}"
else
_DRIVERS_VERSION="{{ DRIVERS_VERSION }}"
fi
tag_array=()
for TAG in $raw_tag_array
do
tag_array+=("-t" $TAG)
done
docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \
${tag_array[@]} \
--build-arg R_VERSION="{{ R_VERSION }}" \
--build-arg R_VERSION_ALT="{{ R_VERSION_ALT }}" \
--build-arg PYTHON_VERSION="{{ PYTHON_VERSION }}" \
--build-arg PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \
--build-arg DRIVERS_VERSION="${_DRIVERS_VERSION}" \
--file=./Dockerfile.$(just -f ../../Justfile _parse-os {{OS}}) .
# Test base image - just test rstudio/product-base-pro:ubuntu1804
test TAG=`just _make-default-tag` CMD="":
#!/usr/bin/env bash
set -euxo pipefail
IMAGE_NAME="{{ TAG }}" \
R_VERSION="{{ R_VERSION }}" \
R_VERSION_ALT="{{ R_VERSION_ALT }}" \
PYTHON_VERSION="{{ PYTHON_VERSION }}" \
PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \
QUARTO_VERSION="{{ QUARTO_VERSION }}" \
TINI_VERSION="{{ TINI_VERSION }}" \
DRIVERS_VERSION="{{ DRIVERS_VERSION }}" \
OS="{{ IMAGE_OS }}" \
docker-compose -f ./docker-compose.test.yml run sut {{ CMD }}
# Test base image interactively - just test-i rstudio/product-base-pro:ubuntu1804
test-i TAG=`just _make-default-tag`:
just test {{ TAG }} bash