diff --git a/.github/workflows/build-latest.yaml b/.github/workflows/build-latest.yaml index 9b2fd18bb..760160a14 100644 --- a/.github/workflows/build-latest.yaml +++ b/.github/workflows/build-latest.yaml @@ -51,13 +51,13 @@ jobs: - name: Get Version id: get-version run: | - VERSION=`just get-version ${{ matrix.config.product }} --type=release --local` + VERSION=`just -f ci.Justfile get-version ${{ matrix.config.product }} --type=release --local` echo "::set-output name=VERSION::$VERSION" - name: Build Image id: build-image run: | - TAGS=`just BUILDX_PATH=${{ steps.buildx.outputs.name }} build-release ${{ matrix.config.product }} ${{ matrix.config.os }} ${{ steps.get-version.outputs.VERSION }}` + TAGS=`just -f ci.Justfile BUILDX_PATH=${{ steps.buildx.outputs.name }} build-release ${{ matrix.config.product }} ${{ matrix.config.os }} ${{ steps.get-version.outputs.VERSION }}` echo "::set-output name=TAGS::$TAGS" - name: Show image size @@ -112,5 +112,5 @@ jobs: - name: Push image(s) to Docker Hub if: ${{ github.ref == 'refs/heads/main' }} run: | - just push-images ${{ steps.build-image.outputs.TAGS }} + just -f ci.Justfile push-images ${{ steps.build-image.outputs.TAGS }} diff --git a/.github/workflows/build-preview.yaml b/.github/workflows/build-preview.yaml index ecb646e1a..0cda03acc 100644 --- a/.github/workflows/build-preview.yaml +++ b/.github/workflows/build-preview.yaml @@ -61,13 +61,13 @@ jobs: - name: Get Version id: get-version run: | - VERSION=`just get-version ${{ matrix.config.product }} --type=${{ matrix.config.type }} --local` + VERSION=`just -f ci.Justfile get-version ${{ matrix.config.product }} --type=${{ matrix.config.type }} --local` echo "::set-output name=VERSION::$VERSION" - name: Build Image id: build-image run: | - TAGS=`just BUILDX_PATH=${{ steps.buildx.outputs.name }} build-preview ${{ matrix.config.type }} ${{ matrix.config.product }} ${{ matrix.config.os }} ${{ steps.get-version.outputs.VERSION }}` + TAGS=`just -f ci.Justfile BUILDX_PATH=${{ steps.buildx.outputs.name }} build-preview ${{ matrix.config.type }} ${{ matrix.config.product }} ${{ matrix.config.os }} ${{ steps.get-version.outputs.VERSION }}` echo "::set-output name=TAGS::$TAGS" - name: Show image size @@ -100,4 +100,4 @@ jobs: - name: Push image(s) to Docker Hub if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/dev-rspm' }} run: | - just push-images ${{ steps.build-image.outputs.TAGS }} + just -f ci.Justfile push-images ${{ steps.build-image.outputs.TAGS }} diff --git a/Justfile b/Justfile index c540abe94..5f337d54b 100644 --- a/Justfile +++ b/Justfile @@ -6,187 +6,149 @@ sed_vars := if os() == "macos" { "-i ''" } else { "-i" } BUILDX_PATH := "" -RSW_VERSION := "2022.07.2+576.pro12" -RSW_TAG_VERSION := replace(RSW_VERSION, "+", "-") RSC_VERSION := "2022.09.0" RSPM_VERSION := "2022.07.2-11" +RSW_VERSION := "2022.07.2+576.pro12" +RSC_TAG_SAFE_VERSION := replace(RSW_VERSION, "+", "-") + +DRIVERS_VERSION := "2021.10.0" + R_VERSION := "3.6.2" R_VERSION_ALT := "4.1.0" PYTHON_VERSION := "3.9.5" PYTHON_VERSION_ALT := "3.8.10" -# just RSW_VERSION=1.2.3 update-versions +# just RSW_VERSION=1.2.3 R_VERSION=4.1.0 update-versions update-versions: just \ - RSW_VERSION={{RSW_VERSION}} RSC_VERSION={{RSC_VERSION}} RSPM_VERSION={{RSPM_VERSION}} \ - R_VERSION={{R_VERSION}} R_VERSION_ALT={{R_VERSION_ALT}} \ - update-rsw-versions update-rspm-versions update-rsc-versions update-r-versions + RSW_VERSION={{RSW_VERSION}} \ + RSC_VERSION={{RSC_VERSION}} \ + RSPM_VERSION={{RSPM_VERSION}} \ + R_VERSION={{R_VERSION}} \ + R_VERSION_ALT={{R_VERSION_ALT}} \ + PYTHON_VERSION={{PYTHON_VERSION}} \ + PYTHON_VERSION_ALT={{PYTHON_VERSION_ALT}} \ + DRIVERS_VERSION={{DRIVERS_VERSION}} \ + update-rsw-versions update-rspm-versions update-rsc-versions update-r-versions update-py-versions update-drivers-versions # just RSW_VERSION=1.2.3 update-rsw-versions update-rsw-versions: #!/usr/bin/env bash set -euxo pipefail - sed {{ sed_vars }} "s/^RSW_VERSION=.*/RSW_VERSION={{ RSW_VERSION }}/g" workbench/.env - sed {{ sed_vars }} "s/^RSW_VERSION=.*/RSW_VERSION={{ RSW_VERSION }}/g" r-session-complete/.env - sed {{ sed_vars }} "s/^ARG RSW_VERSION=.*/ARG RSW_VERSION={{ RSW_VERSION }}/g" r-session-complete/Dockerfile.bionic - sed {{ sed_vars }} "s/^ARG RSW_VERSION=.*/ARG RSW_VERSION={{ RSW_VERSION }}/g" r-session-complete/Dockerfile.centos7 - sed {{ sed_vars }} "s/^ARG RSW_VERSION=.*/ARG RSW_VERSION={{ RSW_VERSION }}/g" workbench/Dockerfile.bionic + sed {{ sed_vars }} "s/RSW_VERSION=.*/RSW_VERSION={{ RSW_VERSION }}/g" \ + workbench/.env \ + r-session-complete/.env \ + workbench-for-microsoft-azure-ml/.env \ + r-session-complete/Dockerfile.bionic \ + r-session-complete/Dockerfile.centos7 \ + workbench/Dockerfile.bionic \ + workbench-for-microsoft-azure-ml/Dockerfile.bionic sed {{ sed_vars }} "s/RSW_VERSION:.*/RSW_VERSION: {{ RSW_VERSION }}/g" docker-compose.yml - sed {{ sed_vars }} "s/rstudio\/rstudio-workbench:.*/rstudio\/rstudio-workbench:{{ RSW_TAG_VERSION }}/g" docker-compose.yml - sed {{ sed_vars }} "s/^ARG RSW_VERSION=.*/ARG RSW_VERSION={{ RSW_VERSION }}/g" workbench-for-microsoft-azure-ml/Dockerfile.bionic + sed {{ sed_vars }} "s/rstudio\/rstudio-workbench:.*/rstudio\/rstudio-workbench:{{ RSC_TAG_SAFE_VERSION }}/g" docker-compose.yml sed {{ sed_vars }} "s/org.opencontainers.image.version='.*'/org.opencontainers.image.version='{{ RSW_VERSION }}'/g" workbench-for-microsoft-azure-ml/Dockerfile.bionic + sed {{ sed_vars }} "s/^RSW_VERSION := .*/RSW_VERSION := \"{{ RSW_VERSION }}\"/g" \ + r-session-complete/Justfile \ + workbench/Justfile \ + workbench-for-microsoft-azure-ml/Justfile \ + Justfile # just RSPM_VERSION=1.2.3 update-rspm-versions update-rspm-versions: #!/usr/bin/env bash set -euxo pipefail - sed {{ sed_vars }} "s/^RSPM_VERSION=.*/RSPM_VERSION={{ RSPM_VERSION }}/g" package-manager/.env - sed {{ sed_vars }} "s/^ARG RSPM_VERSION=.*/ARG RSPM_VERSION={{ RSPM_VERSION }}/g" package-manager/Dockerfile.bionic - sed {{ sed_vars }} "s/^RSPM_VERSION:.*/RSPM_VERSION: {{ RSPM_VERSION }}/g" docker-compose.yml + sed {{ sed_vars }} "s/RSPM_VERSION=.*/RSPM_VERSION={{ RSPM_VERSION }}/g" \ + package-manager/.env \ + package-manager/Dockerfile.bionic sed {{ sed_vars }} "s/RSPM_VERSION:.*/RSPM_VERSION: {{ RSPM_VERSION }}/g" docker-compose.yml sed {{ sed_vars }} "s/rstudio\/rstudio-package-manager:.*/rstudio\/rstudio-package-manager:{{ RSPM_VERSION }}/g" docker-compose.yml + sed {{ sed_vars }} "s/^RSPM_VERSION := .*/RSPM_VERSION := \"{{ RSPM_VERSION }}\"/g" \ + package-manager/Justfile \ + Justfile # just RSC_VERSION=1.2.3 update-rsc-versions update-rsc-versions: #!/usr/bin/env bash set -euxo pipefail - sed {{ sed_vars }} "s/^RSC_VERSION=.*/RSC_VERSION={{ RSC_VERSION }}/g" connect/.env - sed {{ sed_vars }} "s/^ARG RSC_VERSION=.*/ARG RSC_VERSION={{ RSC_VERSION }}/g" connect/Dockerfile.bionic - sed {{ sed_vars }} "s/^ARG RSC_VERSION=.*/ARG RSC_VERSION={{ RSC_VERSION }}/g" connect-content-init/Dockerfile.bionic + sed {{ sed_vars }} "s/RSC_VERSION=.*/RSC_VERSION={{ RSC_VERSION }}/g" \ + connect/.env \ + connect/Dockerfile.bionic \ + connect-content-init/Dockerfile.bionic sed {{ sed_vars }} "s/RSC_VERSION:.*/RSC_VERSION: {{ RSC_VERSION }}/g" docker-compose.yml sed {{ sed_vars }} "s/rstudio\/rstudio-connect:.*/rstudio\/rstudio-connect:{{ RSC_VERSION }}/g" docker-compose.yml - sed {{ sed_vars }} "s/^RSC_VERSION?=.*/RSC_VERSION?={{ RSC_VERSION }}/g" connect-content-init/Makefile + sed {{ sed_vars }} "s/^RSC_VERSION := .*/RSC_VERSION := \"{{ RSC_VERSION }}\"/g" \ + connect/Justfile \ + Justfile -# just R_VERSION=3.2.1 update-r-versions +# just R_VERSION=3.2.1 R_VERSION_ALT=4.1.0 update-r-versions update-r-versions: #!/usr/bin/env bash set -euxo pipefail - sed {{ sed_vars }} "s/^R_VERSION:.*/R_VERSION={{ R_VERSION }}/g" workbench/Dockerfile.bionic - sed {{ sed_vars }} "s/^R_VERSION:.*/R_VERSION={{ R_VERSION }}/g" connect/Dockerfile.bionic - sed {{ sed_vars }} "s/^R_VERSION:.*/R_VERSION={{ R_VERSION }}/g" package-manager/Dockerfile.bionic + # Update primary R versions + sed {{ sed_vars }} "s/R_VERSION=.*/R_VERSION={{ R_VERSION }}/g" \ + workbench/.env \ + connect/.env \ + package-manager/.env \ + workbench/Dockerfile.bionic \ + connect/Dockerfile.bionic \ + package-manager/Dockerfile.bionic sed {{ sed_vars }} "s|^RVersion.*=.*|RVersion = /opt/R/{{ R_VERSION }}/|g" package-manager/rstudio-pm.gcfg - -build-release $PRODUCT $OS $VERSION $BRANCH=`git branch --show` $SHA_SHORT=`git rev-parse --short HEAD`: + sed {{ sed_vars }} "s/^R_VERSION := .*/R_VERSION := \"{{ R_VERSION }}\"/g" \ + workbench/Justfile \ + workbench-for-microsoft-azure-ml/Justfile \ + connect/Justfile package-manager/Justfile \ + Justfile + + # Update alt R versions + sed {{ sed_vars }} "s/R_VERSION_ALT=.*/R_VERSION_ALT={{ R_VERSION_ALT }}/g" \ + workbench/.env \ + connect/.env \ + workbench/Dockerfile.bionic \ + connect/Dockerfile.bionic + sed {{ sed_vars }} "s/^R_VERSION_ALT := .*/R_VERSION_ALT := \"{{ R_VERSION_ALT }}\"/g" \ + workbench/Justfile \ + workbench-for-microsoft-azure-ml/Justfile \ + connect/Justfile \ + Justfile + +# just PYTHON_VERSION=3.9.5 PYTHON_VERSION_ALT=3.8.10 update-py-versions +update-py-versions: #!/usr/bin/env bash set -euxo pipefail - - # variable placeholders - RSW_DOWNLOAD_URL=`just _rsw-download-url release $OS` - BUILDX_ARGS="" - SHORT_NAME="" - TAG_VERSION=`just _tag_safe_version $VERSION` - - # set short name - if [[ $PRODUCT == "workbench" || $PRODUCT == "r-session-complete" || $PRODUCT == "workbench-for-microsoft-azure-ml" ]]; then - SHORT_NAME="RSW" - elif [[ $PRODUCT == "connect" ]]; then - SHORT_NAME="RSC" - elif [[ $PRODUCT == "package-manager" ]]; then - SHORT_NAME="RSPM" - fi - - # set image prefix - if [[ $PRODUCT == "r-session-complete" ]]; then - IMAGE_PREFIX="" - else - IMAGE_PREFIX="rstudio-" - fi - - # set 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 - - docker buildx --builder="{{BUILDX_PATH}}" build --load $BUILDX_ARGS \ - -t rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS} \ - -t rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION} \ - -t rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION}--${SHA_SHORT} \ - -t ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS} \ - -t ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION} \ - -t ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION}--${SHA_SHORT} \ - --build-arg "$SHORT_NAME"_VERSION=$VERSION \ - --build-arg RSW_DOWNLOAD_URL=$RSW_DOWNLOAD_URL \ - --file=./${PRODUCT}/Dockerfile.${OS} ${PRODUCT} - - echo rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS} \ - rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION} \ - rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION}--${SHA_SHORT} \ - ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS} \ - ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION} \ - ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION}--${SHA_SHORT} - -# just BUILDX_PATH=~/.buildx build-preview preview workbench bionic 12.0.11-11 -build-preview $TYPE $PRODUCT $OS $VERSION $BRANCH=`git branch --show`: + # Update primary Python versions + sed {{ sed_vars }} "s/PYTHON_VERSION=.*/PYTHON_VERSION={{ PYTHON_VERSION }}/g" \ + workbench/Dockerfile.bionic \ + workbench/.env \ + connect/Dockerfile.bionic \ + connect/.env \ + package-manager/Dockerfile.bionic \ + package-manager/.env + sed {{ sed_vars }} "s/^PYTHON_VERSION := .*/PYTHON_VERSION := \"{{ PYTHON_VERSION }}\"/g" \ + workbench/Justfile \ + workbench-for-microsoft-azure-ml/Justfile \ + connect/Justfile \ + Justfile + + # Update alt Python versions + sed {{ sed_vars }} "s/PYTHON_VERSION_ALT=.*/PYTHON_VERSION_ALT={{ PYTHON_VERSION_ALT }}/g" \ + workbench/Dockerfile.bionic \ + workbench/.env \ + connect/Dockerfile.bionic \ + connect/.env \ + workbench/Justfile \ + workbench-for-microsoft-azure-ml/Justfile \ + connect/Justfile \ + Justfile + +# just DRIVERS_VERSION=2021.10.0 update-driver-versions +update-drivers-versions: #!/usr/bin/env bash set -euxo pipefail - - # variable placeholders - BRANCH_PREFIX="" - RSW_DOWNLOAD_URL=`just _rsw-download-url $TYPE $OS` - BUILDX_ARGS="" - SHORT_NAME="" - TAG_VERSION=`just _tag_safe_version $VERSION` - - # set branch prefix - if [[ $BRANCH == "dev" ]]; then - BRANCH_PREFIX="dev-" - elif [[ $BRANCH == "dev-rspm" ]]; then - BRANCH_PREFIX="dev-rspm-" - fi - - # set short name - if [[ $PRODUCT == "workbench" || $PRODUCT == "r-session-complete" || $PRODUCT == "workbench-for-microsoft-azure-ml" ]]; then - SHORT_NAME="RSW" - elif [[ $PRODUCT == "connect" || $PRODUCT == "connect-content-init" ]]; then - SHORT_NAME="RSC" - elif [[ $PRODUCT == "package-manager" ]]; then - SHORT_NAME="RSPM" - fi - - # set image prefix - if [[ $PRODUCT == "r-session-complete" ]]; then - IMAGE_PREFIX="" - else - IMAGE_PREFIX="rstudio-" - fi - - # set 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 - - docker buildx --builder="{{BUILDX_PATH}}" build --load $BUILDX_ARGS \ - -t rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TAG_VERSION} \ - -t rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TYPE} \ - -t ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TAG_VERSION} \ - -t ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TYPE} \ - --build-arg ${SHORT_NAME}_VERSION=$VERSION \ - --build-arg RSW_DOWNLOAD_URL=$RSW_DOWNLOAD_URL \ - --file=./${PRODUCT}/Dockerfile.${OS} ${PRODUCT} - - # These tags are propogated forward to test-images and push-images in builds. It is important that these tags match the build tags above. - echo rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TAG_VERSION} \ - rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TYPE} \ - ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TAG_VERSION} \ - ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TYPE} - -_rsw-download-url TYPE OS: - #!/usr/bin/env bash - if [[ "{{TYPE}}" == "release" ]]; then - echo "https://download2.rstudio.org/server/{{OS}}/{{ if OS == "centos7" { "x86_64"} else { "amd64" } }}" - else - echo "https://s3.amazonaws.com/rstudio-ide-build/server/{{OS}}/{{ if OS == "centos7" { "x86_64"} else { "amd64" } }}" - fi - -# just push-images tag1 tag2 ... -push-images +IMAGES: - #!/usr/bin/env bash - set -euxo pipefail - for IMAGE in {{IMAGES}} - do - docker push $IMAGE - done + sed {{ sed_vars }} "s/\"drivers\": \".[^\,\}]*\"/\"drivers\": \"{{ DRIVERS_VERSION }}\"/g" content/matrix.json + sed {{ sed_vars }} "s/DRIVERS_VERSION=.*/DRIVERS_VERSION={{ DRIVERS_VERSION }}/g" workbench-for-microsoft-azure-ml/Dockerfile.bionic + sed {{ sed_vars }} "s/^DRIVERS_VERSION := .*/DRIVERS_VERSION := \"{{ DRIVERS_VERSION }}\"/g" \ + content/pro/Justfile \ + Justfile # just test-image preview workbench 12.0.11-8 tag1 tag2 tag3 ... test-image $PRODUCT $VERSION +IMAGES: @@ -194,18 +156,9 @@ test-image $PRODUCT $VERSION +IMAGES: set -euxo pipefail IMAGES="{{IMAGES}}" read -ra IMAGE_ARRAY <<<"$IMAGES" - cd ./"$PRODUCT" && \ - IMAGE_NAME="${IMAGE_ARRAY[0]}" RSW_VERSION="$VERSION" RSC_VERSION="$VERSION" RSPM_VERSION="$VERSION" \ - docker-compose -f docker-compose.test.yml run sut - -# just get-version workbench --type=preview --local -get-version +NARGS: - ./get-version.py {{NARGS}} - -_tag_safe_version $VERSION: - #!/usr/bin/env bash - echo -n "$VERSION" | sed 's/+/-/g' + just $PRODUCT/test "${IMAGE_ARRAY[0]}" "$VERSION" +# just lint workbench bionic lint $PRODUCT $OS: #!/usr/bin/env bash docker run --rm -i -v $PWD/hadolint.yaml:/.config/hadolint.yaml ghcr.io/hadolint/hadolint < $PRODUCT/Dockerfile.$OS diff --git a/Makefile b/Makefile deleted file mode 100644 index c2ad3fb4b..000000000 --- a/Makefile +++ /dev/null @@ -1,172 +0,0 @@ -IMAGE_OS ?= bionic - -R_VERSION ?= 3.6.2 -R_VERSION_ALT ?= 4.1.0 - -PYTHON_VERSION ?= 3.9.5 -PYTHON_VERSION_ALT ?= 3.8.10 - -RSW_VERSION ?= 2022.07.2+576.pro12 -RSC_VERSION ?= 2022.09.0 -RSPM_VERSION ?= 2022.07.2-11 - -DRIVERS_VERSION ?= 2021.10.0 - -RSW_LICENSE ?= "" -RSC_LICENSE ?= "" -RSPM_LICENSE ?= "" - -RSW_FLOAT_LICENSE ?= "" -RSC_FLOAT_LICENSE ?= "" -RSPM_FLOAT_LICENSE ?= "" -SSP_FLOAT_LICENSE ?= "" - -RSW_LICENSE_SERVER ?= "" -RSC_LICENSE_SERVER ?= "" -RSPM_LICENSE_SERVER ?= "" - -# Optional Command for docker run -CMD ?= - -SHELL := bash -.ONESHELL: -.SHELLFLAGS := -eu -o pipefail -c -.DELETE_ON_ERROR: -MAKEFLAGS += --warn-undefined-variables -MAKEFLAGS += --no-builtin-rules - - -# To avoid the issue between mac and linux -# Mac require -i '', while -i is the preferred on linux -UNAME_S := $(shell uname -s) - -SED_FLAGS="" -ifeq ($(UNAME_S),Linux) - SED_FLAGS="-i" -else ifeq ($(UNAME_S),Darwin) - SED_FLAGS="-i ''" -endif - -RSW_TAG_VERSION=`echo "$(RSW_VERSION)" | sed -e 's/\+/-/'` - -all: help - - -images: workbench connect package-manager ## Build all images - DOCKER_BUILDKIT=1 IMAGE_OS=$(IMAGE_OS) docker-compose build - - -update-versions: ## Update the version files for all products - just RSW_VERSION=${RSW_VERSION} RSC_VERSION=${RSC_VERSION} RSPM_VERSION=${RSPM_VERSION} R_VERSION=${R_VERSION} update-versions - -update-drivers: ## Update the driver version - @sed $(SED_FLAGS) "s/^DRIVERS_VERSION=.*/DRIVERS_VERSION=${DRIVERS_VERSION}/g" content/pro/Makefile - @sed $(SED_FLAGS) "s/\"drivers\": \".[^\,\}]*\"/\"drivers\": \"${DRIVERS_VERSION}\"/g" content/matrix.json - @sed $(SED_FLAGS) "s/^ARG DRIVERS_VERSION=.*/ARG DRIVERS_VERSION=${DRIVERS_VERSION}/g" helper/workbench-for-microsoft-azure-ml/Dockerfile - -rsw: workbench -workbench: ## Build Workbench image - DOCKER_BUILDKIT=1 docker build -t rstudio/rstudio-workbench:$(RSW_TAG_VERSION) --build-arg R_VERSION=$(R_VERSION) --build-arg RSW_VERSION=$(RSW_VERSION) --file workbench/Dockerfile.$(IMAGE_OS) workbench - -test-rsw: test-workbench -test-workbench: - cd ./workbench && IMAGE_NAME=rstudio/rstudio-workbench:$(RSW_TAG_VERSION) docker-compose -f docker-compose.test.yml run sut -test-rsw-i: test-workbench-i -test-workbench-i: - cd ./workbench && IMAGE_NAME=rstudio/rstudio-workbench:$(RSW_TAG_VERSION) docker-compose -f docker-compose.test.yml run sut bash - - -run-rsw: run-workbench -run-workbench: ## Run RSW container - docker rm -f rstudio-workbench - docker run -it \ - --name rstudio-workbench \ - -p 8787:8787 \ - -v $(PWD)/workbench/conf:/etc/rstudio/ \ - -v /run \ - -e RSW_LICENSE=$(RSW_LICENSE) \ - rstudio/rstudio-workbench:$(RSW_TAG_VERSION) $(CMD) - - -rsc: connect -connect: ## Build RSC image - DOCKER_BUILDKIT=1 docker build -t rstudio/rstudio-connect:$(RSC_VERSION) --build-arg R_VERSION=$(R_VERSION) --build-arg RSC_VERSION=$(RSC_VERSION) --file connect/Dockerfile.$(IMAGE_OS) connect - -test-rsc: test-connect -test-connect: - cd ./connect && IMAGE_NAME=rstudio/rstudio-connect:$(RSC_VERSION) docker-compose -f docker-compose.test.yml run sut -test-rsc-i: test-connect-i -test-connect-i: - cd ./connect && IMAGE_NAME=rstudio/rstudio-connect:$(RSC_VERSION) docker-compose -f docker-compose.test.yml run sut bash - - -run-rsc: run-connect -run-connect: ## Run RSC container - docker rm -f rstudio-connect - docker run -it --privileged \ - --name rstudio-connect \ - -p 3939:3939 \ - -v $(CURDIR)/data/rsc:/var/lib/rstudio-connect \ - -v $(CURDIR)/connect/rstudio-connect.gcfg:/etc/rstudio-connect/rstudio-connect.gcfg \ - -e RSC_LICENSE=$(RSC_LICENSE) \ - rstudio/rstudio-connect:$(RSC_VERSION) $(CMD) - - -rspm: package-manager -package-manager: ## Build RSPM image - DOCKER_BUILDKIT=1 docker build -t rstudio/rstudio-package-manager:$(RSPM_VERSION) --build-arg R_VERSION=$(R_VERSION) --build-arg RSPM_VERSION=$(RSPM_VERSION) --file package-manager/Dockerfile.$(IMAGE_OS) package-manager - - -test-rspm: test-package-manager -test-package-manager: - cd ./package-manager && IMAGE_NAME=rstudio/rstudio-package-manager:$(RSPM_VERSION) docker-compose -f docker-compose.test.yml run sut -test-rspm-i: test-package-manager-i -test-package-manager-i: - cd ./package-manager && IMAGE_NAME=rstudio/rstudio-package-manager:$(RSPM_VERSION) docker-compose -f docker-compose.test.yml run sut bash - - -run-rspm: run-package-manager -run-package-manager: ## Run RSPM container - docker rm -f rstudio-package-manager - docker run -it \ - --name rstudio-package-manager \ - -p 4242:4242 \ - -v $(CURDIR)/data/rspm:/data \ - -v $(CURDIR)/package-manager/rstudio-pm.gcfg:/etc/rstudio-pm/rstudio-pm.gcfg \ - -e RSPM_LICENSE=$(RSPM_LICENSE) \ - rstudio/rstudio-package-manager:$(RSPM_VERSION) $(CMD) - - -test-all: rspm test-rspm rsc test-rsc rsw test-rsw - -test-azure: test-rsw-azure - -rsw-azure: workbench-azure -workbench-azure: ## Build Workbench for Microsoft Azure ML image - DOCKER_BUILDKIT=1 docker build \ - -t rstudio/rstudio-workbench-for-microsoft-azure-ml:$(RSW_TAG_VERSION) \ - --build-arg R_VERSION=$(R_VERSION) \ - --build-arg RSW_VERSION=$(RSW_VERSION) \ - helper/workbench-for-microsoft-azure-ml - -test-rsw-azure: test-workbench-azure -test-workbench-azure: - cd ./helper/workbench-for-microsoft-azure-ml && IMAGE_NAME=rstudio/rstudio-workbench-for-microsoft-azure-ml:$(RSW_TAG_VERSION) docker-compose -f docker-compose.test.yml run sut -test-rsw-azure-i: test-workbench-azure-i -test-workbench-azure-i: - cd ./helper/workbench-for-microsoft-azure-ml && IMAGE_NAME=rstudio/rstudio-workbench-for-microsoft-azure-ml:$(RSW_TAG_VERSION) docker-compose -f docker-compose.test.yml run sut bash - -float: - docker-compose -f helper/float/docker-compose.yml build - -run-float: run-floating-lic-server -run-floating-lic-server: ## [DO NOT USE IN PRODUCTION] Run the floating license server for pro products - RSW_FLOAT_LICENSE=$(RSW_FLOAT_LICENSE) RSC_FLOAT_LICENSE=$(RSC_FLOAT_LICENSE) RSPM_FLOAT_LICENSE=$(RSPM_FLOAT_LICENSE) SSP_FLOAT_LICENSE=$(SSP_FLOAT_LICENSE) \ - docker-compose -f helper/float/docker-compose.yml up - - -help: ## Show this help menu - @grep -E '^[0-9a-zA-Z_-]+:.*?##.*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?##"; OFS="\t\t"}; {printf "\033[36m%-30s\033[0m %s\n", $$1, ($$2==""?"":$$2)}' - - -.PHONY: workbench rsw run-workbench connect rsc run-connect package-manager rspm run-package-manager run-floatating-lic-server diff --git a/NEWS.md b/NEWS.md index d4c815043..a713a56db 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,9 @@ changed in each image. This file only captures pervasive, repository-wide changes. +# 2022-10-12 +- We replaced all `make` definitions with [`just`](https://just.systems/man/en) for ease of use. + # 2022-08-24 - We removed the generic latest tag from all products (excluding content images). Now `latest` variants of images are os-specific. When pulling the latest version of diff --git a/README.md b/README.md index ae4bbd21b..cfd75715e 100644 --- a/README.md +++ b/README.md @@ -71,31 +71,34 @@ sales@rstudio.com. # Instructions for building After you have cloned [rstudio-docker-products](https://github.com/rstudio/rstudio-docker-products), you can create your -own containers fairly simply with the provided Makefile. +own containers fairly simply with the provided Justfiles. If you're unfamiliar with `just`, please check out +[their documentation](https://just.systems/man/en). If you are unable to use `just` in your organization, +most targets in each Justfile can be copy/pasted into your shell and ran there with variables replaced where +appropriate. To build RStudio Workbench: ``` -make workbench +just workbench/build ``` To build RStudio Connect: ``` -make connect +just connect/build ``` To build RStudio Package Manager: ``` -make package-manager +just package-manager/build ``` You can alter what exactly is built by changing `workbench/Dockerfile.$OS`, `connect/Dockerfile.$OS`, and `package-manager/Dockerfile.$OS`. -You can then run what you've built to test out with the `run-` commands. For instance, to run the workbench container +You can then run what you've built to test out with the `run` commands. For instance, to run the workbench container you have built: ``` -make run-workbench +just workbench/run ``` -Note you must have a license in place, and all of the other instructions in separate sections are still relevant. +Note you must have a license in place, and all other instructions in separate sections are still relevant. If you have created an image you want to use yourself, you can push to your own image repository system. The images are named `rstudio-workbench`, `rstudio-connect`, and `rstudio-package-manager`. diff --git a/RELEASE.md b/RELEASE.md index 88b7887bc..f7c923609 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -6,26 +6,21 @@ Hub](https://hub.docker.com/u/rstudio) in the RStudio organization. ## Updating Product Versions To update the version for the `rstudio/rstudio-connect` image, for instance: -- update the `RSC_VERSION` number in the [`Makefile`](./Makefile) -- run `make update-versions` +- update the `RSC_VERSION` number in the [`Justfile`](./Justfile) +- run `just update-versions` - submit a PR - the next build on `main` will tag the image with the appropriate version number -For RStudio Connect, edit `RSC_VERSION` +For RStudio Connect, edit `RSC_VERSION`. -For RStudio Workbench, edit `RSW_VERSION` +For RStudio Workbench, edit `RSW_VERSION`. -For RStudio Package Manager, edit `RSPM_VERSION` +For RStudio Package Manager, edit `RSPM_VERSION`. **IMPORTANT NOTE:** The "default" ARG value in the respective `Dockerfile` has no effect on the build process -**ALSO:** When updating `RSW_VERSION`, be sure to update the -[`helper/workbench-for-microsoft-azure-ml/Dockerfile`](./helper/workbench-for-microsoft-azure-ml/Dockerfile) -with both a `RSW_VERSION` and a version label. The `Makefile` does not yet -handle this case well. - ## Building Images in CI GitHub Actions build a matrix of many images: @@ -41,8 +36,7 @@ we also push to [Docker Hub](https://hub.docker.com/u/rstudio) and [GitHub Conta It is possible to test locally from a product directory by using: ``` -# from ./connect -docker-compose -f docker-compose.test.yml up +just test ``` If you want to write goss tests, diff --git a/ci.Justfile b/ci.Justfile new file mode 100644 index 000000000..7c925859b --- /dev/null +++ b/ci.Justfile @@ -0,0 +1,135 @@ +set positional-arguments + +BUILDX_PATH := "" + +# just BUILDX_PATH=~/.buildx build-release workbench bionic 12.0.11-11 +build-release $PRODUCT $OS $VERSION $BRANCH=`git branch --show` $SHA_SHORT=`git rev-parse --short HEAD`: + #!/usr/bin/env bash + set -euxo pipefail + + # variable placeholders + RSW_DOWNLOAD_URL=`just -f ci.Justfile _get-rsw-download-url release $OS` + BUILDX_ARGS="" + SHORT_NAME="" + TAG_VERSION=`just -f ci.Justfile _get-tag-safe-version $VERSION` + + # set short name + if [[ $PRODUCT == "workbench" || $PRODUCT == "r-session-complete" || $PRODUCT == "workbench-for-microsoft-azure-ml" ]]; then + SHORT_NAME="RSW" + elif [[ $PRODUCT == "connect" ]]; then + SHORT_NAME="RSC" + elif [[ $PRODUCT == "package-manager" ]]; then + SHORT_NAME="RSPM" + fi + + # set image prefix + if [[ $PRODUCT == "r-session-complete" ]]; then + IMAGE_PREFIX="" + else + IMAGE_PREFIX="rstudio-" + fi + + # set 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 + + docker buildx --builder="{{BUILDX_PATH}}" build --load $BUILDX_ARGS \ + -t rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS} \ + -t rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION} \ + -t rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION}--${SHA_SHORT} \ + -t ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS} \ + -t ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION} \ + -t ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION}--${SHA_SHORT} \ + --build-arg "$SHORT_NAME"_VERSION=$VERSION \ + --build-arg RSW_DOWNLOAD_URL=$RSW_DOWNLOAD_URL \ + --file=./${PRODUCT}/Dockerfile.${OS} ${PRODUCT} + + echo rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS} \ + rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION} \ + rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION}--${SHA_SHORT} \ + ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS} \ + ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION} \ + ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}:${OS}-${TAG_VERSION}--${SHA_SHORT} + +# just BUILDX_PATH=~/.buildx build-preview preview workbench bionic 12.0.11-11 +build-preview $TYPE $PRODUCT $OS $VERSION $BRANCH=`git branch --show`: + #!/usr/bin/env bash + set -euxo pipefail + + # variable placeholders + BRANCH_PREFIX="" + RSW_DOWNLOAD_URL=`just -f ci.Justfile _get-rsw-download-url $TYPE $OS` + BUILDX_ARGS="" + SHORT_NAME="" + TAG_VERSION=`just -f ci.Justfile _get-tag-safe-version $VERSION` + + # set branch prefix + if [[ $BRANCH == "dev" ]]; then + BRANCH_PREFIX="dev-" + elif [[ $BRANCH == "dev-rspm" ]]; then + BRANCH_PREFIX="dev-rspm-" + fi + + # set short name + if [[ $PRODUCT == "workbench" || $PRODUCT == "r-session-complete" || $PRODUCT == "workbench-for-microsoft-azure-ml" ]]; then + SHORT_NAME="RSW" + elif [[ $PRODUCT == "connect" || $PRODUCT == "connect-content-init" ]]; then + SHORT_NAME="RSC" + elif [[ $PRODUCT == "package-manager" ]]; then + SHORT_NAME="RSPM" + fi + + # set image prefix + if [[ $PRODUCT == "r-session-complete" ]]; then + IMAGE_PREFIX="" + else + IMAGE_PREFIX="rstudio-" + fi + + # set 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 + + docker buildx --builder="{{BUILDX_PATH}}" build --load $BUILDX_ARGS \ + -t rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TAG_VERSION} \ + -t rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TYPE} \ + -t ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TAG_VERSION} \ + -t ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TYPE} \ + --build-arg ${SHORT_NAME}_VERSION=$VERSION \ + --build-arg RSW_DOWNLOAD_URL=$RSW_DOWNLOAD_URL \ + --file=./${PRODUCT}/Dockerfile.${OS} ${PRODUCT} + + # These tags are propogated forward to test-images and push-images in builds. It is important that these tags match the build tags above. + echo rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TAG_VERSION} \ + rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TYPE} \ + ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TAG_VERSION} \ + ghcr.io/rstudio/${IMAGE_PREFIX}${PRODUCT}-preview:${BRANCH_PREFIX}${OS}-${TYPE} + +# just push-images tag1 tag2 ... +push-images +IMAGES: + #!/usr/bin/env bash + set -euxo pipefail + for IMAGE in {{IMAGES}} + do + docker push $IMAGE + done + +# just _get-rsw-download-url release bionic +_get-rsw-download-url TYPE OS: + #!/usr/bin/env bash + if [[ "{{TYPE}}" == "release" ]]; then + echo "https://download2.rstudio.org/server/{{OS}}/{{ if OS == "centos7" { "x86_64"} else { "amd64" } }}" + else + echo "https://s3.amazonaws.com/rstudio-ide-build/server/{{OS}}/{{ if OS == "centos7" { "x86_64"} else { "amd64" } }}" + fi + +# just _get-tag-safe-version 2022.07.2+576.pro12 +_get-tag-safe-version $VERSION: + #!/usr/bin/env bash + echo -n "$VERSION" | sed 's/+/-/g' + +# just get-version workbench --type=preview --local +get-version +NARGS: + ./tools/get-version.py {{NARGS}} diff --git a/connect-content-init/Justfile b/connect-content-init/Justfile new file mode 100644 index 000000000..e0206e449 --- /dev/null +++ b/connect-content-init/Justfile @@ -0,0 +1,44 @@ +set positional-arguments + +BUILDX_PATH := "" + +IMAGE_PREFIX := "rstudio-" +PRODUCT := "connect-content-init" +IMAGE_OS := "bionic" + +RSC_VERSION := "2022.09.0" +RSC_TAG_SAFE_VERSION := replace(RSC_VERSION, "+", "-") +RSC_LICENSE := "" + +DEFAULT_TAG := IMAGE_PREFIX + PRODUCT + ":" + IMAGE_OS + "-" + RSC_TAG_SAFE_VERSION + +# Build Connect content init image - just build bionic 2022.09.0 rstudio/rstudio-connect-content-init:bionic-2022.09.0 +build OS=IMAGE_OS VERSION=RSC_VERSION +TAGS=DEFAULT_TAG: + #!/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 + tag_array=() + for TAG in {{TAGS}} + do + tag_array+=("-t" $TAG) + done + + docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \ + ${tag_array[@]} \ + --build-arg RSC_VERSION="{{ VERSION }}" \ + --file=./Dockerfile."{{ OS }}" . + +# Test Connect content init image - just test rstudio/rstudio-connect:bionic-2022.09.0 2022.09.0 +test TAG=DEFAULT_TAG VERSION=RSC_VERSION CMD="": + #!/usr/bin/env bash + set -euxo pipefail + IMAGE_NAME="{{ TAG }}" \ + RSC_VERSION="{{ VERSION }}" \ + docker-compose -f ./docker-compose.test.yml run sut {{ CMD }} + +# Test Connect content init image interactively - just test-i rstudio/rstudio-connect:bionic-2022.09.0 2022.09.0 +test-i TAG=DEFAULT_TAG VERSION=RSC_VERSION: + just test {{ TAG }} {{ VERSION }} bash diff --git a/connect-content-init/Makefile b/connect-content-init/Makefile deleted file mode 100644 index 96c63427e..000000000 --- a/connect-content-init/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# -# Makefile to build the "copy container" Docker images. -# -# Build and push an image with the default configuration. -# make all -# -# Build and push an image with alternate Connect versions. -# make RSC_VERSION= - -TAG_BASE?=rstudio/rstudio-connect-content-init-preview -RSC_VERSION?=2022.09.0 - -all: build -.PHONY: all - -# Builds the image using a given RSC distribution for runtime artifacts. -build: - DOCKER_BUILDKIT=1 docker build --build-arg RSC_VERSION=$(RSC_VERSION) -t $(TAG_BASE):$(RSC_VERSION) -f Dockerfile.bionic . -.PHONY: build - -# Do not run push if you are not Cole. -push: build - docker push $(TAG_BASE):$(RSC_VERSION) -.PHONY: push - -test: - IMAGE_NAME=$(TAG_BASE):$(RSC_VERSION) docker-compose -f docker-compose.test.yml run sut -.PHONY: test diff --git a/connect-content-init/README.md b/connect-content-init/README.md index e2a4755b8..793cf1a4e 100644 --- a/connect-content-init/README.md +++ b/connect-content-init/README.md @@ -12,17 +12,17 @@ Launcher to build/run content. ## building -Make will build an image using a default Connect distribution. +Just will build an image using a default Connect distribution. ```console -make build +just build ``` The version of the release package to use can be overridden with the `RSC_VERSION` build arg. ```console -RSC_VERSION=1.8.8.3-dev236 make build +just build bionic 1.8.8.3-dev236 ``` ## testing @@ -36,6 +36,11 @@ docker run --rm -v $(pwd)/rstudio-connect-runtime:/mnt/rstudio-connect-runtime r # runtime components. ``` +You can also test using goss: +```console +just test +``` + ## inspection @@ -45,7 +50,7 @@ You can see the different layers that make up the image: docker history rstudio/rstudio-connect-content-init-preview:1.8.8.3-dev236 ``` -NOTE: almost all of the image size is pandoc. +NOTE: almost all the image size is pandoc. # Licensing diff --git a/connect/Justfile b/connect/Justfile new file mode 100644 index 000000000..71275ea99 --- /dev/null +++ b/connect/Justfile @@ -0,0 +1,71 @@ +set positional-arguments + +BUILDX_PATH := "" + +IMAGE_PREFIX := "rstudio-" +PRODUCT := "connect" +IMAGE_OS := "bionic" + +RSC_VERSION := "2022.09.0" +RSC_TAG_SAFE_VERSION := replace(RSC_VERSION, "+", "-") +RSC_LICENSE := "" + +R_VERSION := "3.6.2" +R_VERSION_ALT := "4.1.0" + +PYTHON_VERSION := "3.9.5" +PYTHON_VERSION_ALT := "3.8.10" + +DEFAULT_TAG := IMAGE_PREFIX + PRODUCT + ":" + IMAGE_OS + "-" + RSC_TAG_SAFE_VERSION + +# Build Connect image - just build bionic 2022.09.0 rstudio/rstudio-connect:bionic-2022.09.0 +build OS=IMAGE_OS VERSION=RSC_VERSION +TAGS=DEFAULT_TAG: + #!/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 + tag_array=() + for TAG in {{TAGS}} + do + tag_array+=("-t" $TAG) + done + + docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \ + ${tag_array[@]} \ + --build-arg RSC_VERSION="{{ VERSION }}" \ + --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 }}" \ + --file=./Dockerfile."{{ OS }}" . + +# Test Connect image - just test rstudio/rstudio-connect:bionic-2022.09.0 2022.09.0 +test TAG=DEFAULT_TAG VERSION=RSC_VERSION CMD="": + #!/usr/bin/env bash + set -euxo pipefail + IMAGE_NAME="{{ TAG }}" \ + RSC_VERSION="{{ VERSION }}" \ + R_VERSION="{{ R_VERSION }}" \ + R_VERSION_ALT="{{ R_VERSION_ALT }}" \ + PYTHON_VERSION="{{ PYTHON_VERSION }}" \ + PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \ + docker-compose -f ./docker-compose.test.yml run sut {{ CMD }} + +# Test Connect image interactively - just test-i rstudio/rstudio-connect:bionic-2022.09.0 2022.09.0 +test-i TAG=DEFAULT_TAG VERSION=RSC_VERSION: + just test {{ TAG }} {{ VERSION }} bash + +# Run Connect - just RSC_LICENSE="" run rstudio/rstudio-connect:bionic-2022.09.0 +run TAG=DEFAULT_TAG CMD="": + #!/usr/bin/env bash + set -euxo pipefail + if [ -z "{{ RSC_LICENSE }}" ]; then + echo "Please set RSC_LICENSE to a valid RStudio Connect license before running." + exit 1 + fi + docker run -it --privileged \ + -p 3939:3939 \ + -e RSC_LICENSE="{{ RSC_LICENSE }}" \ + "{{ TAG }}" {{ CMD }} diff --git a/connect/README.md b/connect/README.md index 6de7f32c7..74e790d33 100644 --- a/connect/README.md +++ b/connect/README.md @@ -28,6 +28,9 @@ docker run -it --privileged \ -p 3939:3939 \ -e RSC_LICENSE=$RSC_LICENSE \ rstudio/rstudio-connect:latest + +# Alternatively, the above can be ran using a single just command +just RSC_LICENSE=XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX run ``` Open [http://localhost:3939](http://localhost:3939) to access RStudio Connect. @@ -43,9 +46,11 @@ requirements and how to extend this image. This container includes: -1. R 3.6.1 -2. Python 3.6.5 -3. RStudio Connect +1. R 3.6 +2. R 4.1 +3. Python 3.8.10 +4. Python 3.9.5 +5. RStudio Connect Note that running the RStudio Connect Docker image requires the container to run using the `--privileged` flag and a valid RStudio Connect license. diff --git a/content/base/Justfile b/content/base/Justfile new file mode 100755 index 000000000..93e329523 --- /dev/null +++ b/content/base/Justfile @@ -0,0 +1,39 @@ +set positional-arguments + +BUILDX_PATH := "" + +IMAGE_PREFIX := "rstudio/" +PRODUCT := "content-base" +IMAGE_OS := "bionic" + +R_VERSION := "3.6.3" + +PYTHON_VERSION := "3.9.5" + +MINICONDA_VERSION := "4.7.12.1" + +QUARTO_VERSION := "1.0.37" + +DEFAULT_TAG := IMAGE_PREFIX + PRODUCT + ":r" + R_VERSION + "-py" + PYTHON_VERSION + "-" + IMAGE_OS + +# Build content base image - just build bionic 3.6.3 3.9.5 rstudio/content-base:r3.6.3-py3.9.5-bionic +build OS=IMAGE_OS _R_VERSION=R_VERSION _PYTHON_VERSION=PYTHON_VERSION +TAGS=DEFAULT_TAG: + #!/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 + tag_array=() + for TAG in {{TAGS}} + 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 PYTHON_VERSION="{{ _PYTHON_VERSION }}" \ + --build-arg MINICONDA_VERSION="{{ MINICONDA_VERSION }}" \ + --build-arg QUARTO_VERSION="{{ QUARTO_VERSION }}" \ + --file="{{ OS }}/Dockerfile" "{{ OS }}" diff --git a/content/base/Makefile b/content/base/Makefile deleted file mode 100644 index 0f0a7a18f..000000000 --- a/content/base/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# Makefile to build the "base" Docker images. -# -# Build and push an image with the default configuration. -# make all -# -# Build and push an image with alternate R/Python versions. -# make R_VERSION=4.0.4 PYTHON_VERSION=3.9.2 -# -# Print the Docker tag associated with the image: -# make tag -# make R_VERSION=4.0.4 PYTHON_VERSION=3.9.2 tag - -DISTRIBUTION=bionic -TAG_BASE=rstudio/content-base -R_VERSION=3.6.3 -PYTHON_VERSION=3.7.6 - -all: build -.PHONY: all - -# Builds the image for a single distribution. Expects that the Dockerfile for -# this image is in a sub-directory with the distribution name as its name. -# -# We could, in the future, follow the lead of r-builds and use docker-compose -# and perform the build in parallel. -# See: https://github.com/rstudio/r-builds/blob/0eaf4ff908f5944c152f89128bbffb3f73ce1c95/Makefile#L7-L8 -build: - docker build --build-arg R_VERSION=$(R_VERSION) --build-arg PYTHON_VERSION=$(PYTHON_VERSION) -t $(TAG_BASE):r$(R_VERSION)-py$(PYTHON_VERSION)-$(DISTRIBUTION) $(DISTRIBUTION) -.PHONY: build - -push: build - docker push $(TAG_BASE):r$(R_VERSION)-py$(PYTHON_VERSION)-$(DISTRIBUTION) -.PHONY: push - -# Enumeration of image tags for all supported distributions. -TAGS=$(DISTRIBUTIONS:%=$(TAG_BASE):r$(R_VERSION)-py$(PYTHON_VERSION)-%) - -# Prints the Docker tag associated with the configured image. -tag: - @echo "$(TAG_BASE):r$(R_VERSION)-py$(PYTHON_VERSION)-$(DISTRIBUTION)" -.PHONY: tag diff --git a/content/base/README.md b/content/base/README.md index 11e8489f3..eb1ef638f 100644 --- a/content/base/README.md +++ b/content/base/README.md @@ -1,11 +1,9 @@ ## Build -By default, the `all` target builds the image. - ```console -# Creates rstudio/content-base:r3.6.3-py3.7.6-bionic -make +# Creates rstudio/content-base:r3.6.3-py3.9.5-bionic +just build # Creates rstudio/content-base:r4.0.4-py3.9.2-bionic -make R_VERSION=4.0.4 PYTHON_VERSION=3.9.2 +just R_VERSION=4.0.4 PYTHON_VERSION=3.9.2 build ``` diff --git a/content/build-images.sh b/content/build-images.sh index 5c93b860f..717eabb53 100755 --- a/content/build-images.sh +++ b/content/build-images.sh @@ -1,37 +1,35 @@ #!/usr/bin/env bash -set -e +set -ex if [ $# -eq 0 ] ; then echo "usage: $0 ..." echo echo "Common uses:" - echo " $0 tag" echo " $0 build" - echo " $0 push" exit 1 fi TARGETS="$@" build() { - make ${1} R_VERSION=3.1.3 PYTHON_VERSION=2.7.18 - make ${1} R_VERSION=3.2.5 PYTHON_VERSION=2.7.18 - make ${1} R_VERSION=3.3.3 PYTHON_VERSION=3.6.13 - make ${1} R_VERSION=3.3.3 PYTHON_VERSION=3.6.13 - make ${1} R_VERSION=3.4.4 PYTHON_VERSION=3.6.13 - make ${1} R_VERSION=3.4.4 PYTHON_VERSION=3.7.10 - make ${1} R_VERSION=3.5.3 PYTHON_VERSION=2.7.18 - make ${1} R_VERSION=3.5.3 PYTHON_VERSION=3.7.10 - make ${1} R_VERSION=3.6.3 PYTHON_VERSION=2.7.18 - make ${1} R_VERSION=3.6.3 PYTHON_VERSION=3.6.13 - make ${1} R_VERSION=3.6.3 PYTHON_VERSION=3.8.8 - make ${1} R_VERSION=4.0.5 PYTHON_VERSION=3.6.13 - make ${1} R_VERSION=4.0.5 PYTHON_VERSION=3.7.10 - make ${1} R_VERSION=4.0.5 PYTHON_VERSION=3.8.8 - make ${1} R_VERSION=4.0.5 PYTHON_VERSION=3.9.2 - make ${1} R_VERSION=4.1.0 PYTHON_VERSION=3.8.8 - make ${1} R_VERSION=4.1.0 PYTHON_VERSION=3.9.2 + just R_VERSION=3.1.3 PYTHON_VERSION=2.7.18 ${1} + just R_VERSION=3.2.5 PYTHON_VERSION=2.7.18 ${1} + just R_VERSION=3.3.3 PYTHON_VERSION=3.6.13 ${1} + just R_VERSION=3.3.3 PYTHON_VERSION=3.6.13 ${1} + just R_VERSION=3.4.4 PYTHON_VERSION=3.6.13 ${1} + just R_VERSION=3.4.4 PYTHON_VERSION=3.7.10 ${1} + just R_VERSION=3.5.3 PYTHON_VERSION=2.7.18 ${1} + just R_VERSION=3.5.3 PYTHON_VERSION=3.7.10 ${1} + just R_VERSION=3.6.3 PYTHON_VERSION=2.7.18 ${1} + just R_VERSION=3.6.3 PYTHON_VERSION=3.6.13 ${1} + just R_VERSION=3.6.3 PYTHON_VERSION=3.8.8 ${1} + just R_VERSION=4.0.5 PYTHON_VERSION=3.6.13 ${1} + just R_VERSION=4.0.5 PYTHON_VERSION=3.7.10 ${1} + just R_VERSION=4.0.5 PYTHON_VERSION=3.8.8 ${1} + just R_VERSION=4.0.5 PYTHON_VERSION=3.9.2 ${1} + just R_VERSION=4.1.0 PYTHON_VERSION=3.8.8 ${1} + just R_VERSION=4.1.0 PYTHON_VERSION=3.9.2 ${1} } # build content-base diff --git a/content/pro/Justfile b/content/pro/Justfile new file mode 100755 index 000000000..acb6d0444 --- /dev/null +++ b/content/pro/Justfile @@ -0,0 +1,34 @@ +set positional-arguments + +BUILDX_PATH := "" + +IMAGE_PREFIX := "rstudio/" +PRODUCT := "content-pro" +IMAGE_OS := "bionic" + +R_VERSION := "3.6.3" + +PYTHON_VERSION := "3.9.5" + +DRIVERS_VERSION := "2021.10.0" + +DEFAULT_TAG := IMAGE_PREFIX + PRODUCT + ":r" + R_VERSION + "-py" + PYTHON_VERSION + "-" + IMAGE_OS + +# Build content pro image - just build bionic 3.6.3 3.9.5 rstudio/content-pro:r3.6.3-py3.9.5-bionic +build OS=IMAGE_OS _R_VERSION=R_VERSION _PYTHON_VERSION=PYTHON_VERSION +TAGS=DEFAULT_TAG: + #!/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 + tag_array=() + for TAG in {{TAGS}} + do + tag_array+=("-t" $TAG) + done + + docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \ + ${tag_array[@]} \ + --build-arg DRIVERS_VERSION="{{ DRIVERS_VERSION }}" + --file="{{ OS }}/Dockerfile" "{{ OS }}" diff --git a/content/pro/Makefile b/content/pro/Makefile deleted file mode 100644 index c3485de4a..000000000 --- a/content/pro/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# Makefile to build the "base-pro" Docker images. -# -# Build an image with the default configuration. -# make all -# -# Build an image with alternate R/Python versions. -# make R_VERSION=4.0.4 PYTHON_VERSION=3.9.2 -# -# Print the Docker tag associated with the image: -# make tag -# make R_VERSION=4.0.4 PYTHON_VERSION=3.9.2 tag - -DISTRIBUTION=bionic -TAG_BASE=rstudio/content-base -TAG_PRO=rstudio/content-pro -R_VERSION=3.6.3 -PYTHON_VERSION=3.7.6 -DRIVERS_VERSION=2021.10.0 - -all: build -.PHONY: all - -# Builds the image for a single distribution. Expects that the Dockerfile for -# this image is in a sub-directory with the distribution name as its name. -# -# We could, in the future, follow the lead of r-builds and use docker-compose -# and perform the build in parallel. -# See: https://github.com/rstudio/r-builds/blob/0eaf4ff908f5944c152f89128bbffb3f73ce1c95/Makefile#L7-L8 -build: - docker build --build-arg R_VERSION=$(R_VERSION) \ - --build-arg PYTHON_VERSION=$(PYTHON_VERSION) \ - --build-arg DRIVERS_VERSION=$(DRIVERS_VERSION) \ - --build-arg BASE_IMAGE="$(TAG_BASE):r$(R_VERSION)-py$(PYTHON_VERSION)-$(DISTRIBUTION)" \ - -t $(TAG_PRO):r$(R_VERSION)-py$(PYTHON_VERSION)-$(DISTRIBUTION) $(DISTRIBUTION) -.PHONY: build - -push: build - docker push $(TAG_PRO):r$(R_VERSION)-py$(PYTHON_VERSION)-$(DISTRIBUTION) -.PHONY: push - -# Prints the Docker tag associated with the configured image. -tag: - @echo "$(TAG_PRO):r$(R_VERSION)-py$(PYTHON_VERSION)-$(DISTRIBUTION)" -.PHONY: tag diff --git a/content/pro/README.md b/content/pro/README.md index 1e140d448..254301c50 100644 --- a/content/pro/README.md +++ b/content/pro/README.md @@ -1,11 +1,9 @@ ## Build -By default, the `all` target builds the image. - ```console -# Creates rstudio/content-pro:r3.6.3-py3.7.6-bionic -make +# Creates rstudio/content-pro:r3.6.3-py3.9.5-bionic +just build # Creates rstudio/content-pro:r4.0.4-py3.9.2-bionic -make R_VERSION=4.0.4 PYTHON_VERSION=3.9.2 +just R_VERSION=4.0.4 PYTHON_VERSION=3.9.2 build ``` diff --git a/content/pro/bionic/Dockerfile b/content/pro/bionic/Dockerfile index c55b9655c..b84e586ae 100644 --- a/content/pro/bionic/Dockerfile +++ b/content/pro/bionic/Dockerfile @@ -1,5 +1,6 @@ -ARG BASE_IMAGE -FROM ${BASE_IMAGE} +ARG PYTHON_VERSION +ARG R_VERSION +FROM rstudio/content-pro:r${R_VERSION}-py${PYTHON_VERSION}-bionic MAINTAINER RStudio Docker diff --git a/float/Justfile b/float/Justfile new file mode 100644 index 000000000..b187f9c19 --- /dev/null +++ b/float/Justfile @@ -0,0 +1,14 @@ +RSC_FLOAT_LICENSE := "" +RSPM_FLOAT_LICENSE := "" +RSW_FLOAT_LICENSE := "" + +# Build floating license server - just build +build: + docker-compose build + +# Run floating license server - just RSW_FLOAT_LICENSE="" RSC_FLOAT_LICENSE="" RSPM_FLOAT_LICENSE="" run +run: + RSW_FLOAT_LICENSE="{{ RSW_FLOAT_LICENSE }}" \ + RSC_FLOAT_LICENSE="{{ RSC_FLOAT_LICENSE }}" \ + RSPM_FLOAT_LICENSE="{{ RSPM_FLOAT_LICENSE }}" \ + docker-compose -f helper/float/docker-compose.yml up diff --git a/float/README.md b/float/README.md index 5cb529897..d247c5ae3 100644 --- a/float/README.md +++ b/float/README.md @@ -18,7 +18,7 @@ export RSW_FLOAT_LICENSE=XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX export RSC_FLOAT_LICENSE=XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX export RSPM_FLOAT_LICENSE=XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX -make run-floating-lic-server +just run ``` This will build and run 3 containers that are accessible in the `rstudio-docker-products` network at these hostnames: diff --git a/package-manager/Justfile b/package-manager/Justfile new file mode 100644 index 000000000..6d4247848 --- /dev/null +++ b/package-manager/Justfile @@ -0,0 +1,61 @@ +set positional-arguments + +BUILDX_PATH := "" + +IMAGE_PREFIX := "rstudio-" +PRODUCT := "package-manager" +IMAGE_OS := "bionic" + +RSPM_VERSION := "2022.07.2-11" +RSPM_TAG_SAFE_VERSION := replace(RSPM_VERSION, "+", "-") +RSPM_LICENSE := "" + +R_VERSION := "3.6.2" + +DEFAULT_TAG := IMAGE_PREFIX + PRODUCT + ":" + IMAGE_OS + "-" + RSPM_TAG_SAFE_VERSION + +# Build Package Manager image - just build bionic 2022.07.2-11 rstudio/rstudio-connect:bionic-2022.07.2-11 +build OS=IMAGE_OS VERSION=RSPM_VERSION +TAGS=DEFAULT_TAG: + #!/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 + tag_array=() + for TAG in {{TAGS}} + do + tag_array+=("-t" $TAG) + done + + docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \ + ${tag_array[@]} \ + --build-arg RSPM_VERSION="{{ VERSION }}" \ + --build-arg R_VERSION="{{ R_VERSION }}" \ + --file=./Dockerfile."{{ OS }}" . + +# Test Package Manager image - just test rstudio/rstudio-connect:bionic-2022.07.2-11 2022.07.2-11 +test TAG=DEFAULT_TAG VERSION=RSPM_VERSION CMD="": + #!/usr/bin/env bash + set -euxo pipefail + IMAGE_NAME="{{ TAG }}" \ + RSPM_VERSION="{{ VERSION }}" \ + R_VERSION="{{ R_VERSION }}" \ + docker-compose -f ./docker-compose.test.yml run sut {{ CMD }} + +# Test Package Manager image interactively - just test-i rstudio/rstudio-connect:bionic-2022.07.2-11 2022.07.2-11 +test-i TAG=DEFAULT_TAG VERSION=RSPM_VERSION: + just test {{ TAG }} {{ VERSION }} bash + +# Run Package Manager - just RSPM_LICENSE="" run rstudio/rstudio-connect:bionic-2022.07.2-11 +run TAG=DEFAULT_TAG CMD="": + #!/usr/bin/env bash + set -euxo pipefail + if [ -z "{{ RSPM_LICENSE }}" ]; then + echo "Please set RSPM_LICENSE to a valid RStudio Package Manager license before running." + exit 1 + fi + docker run -it \ + -p 4242:4242 \ + -e RSPM_LICENSE="{{ RSPM_LICENSE }}" \ + "{{ TAG }}" {{ CMD }} diff --git a/package-manager/README.md b/package-manager/README.md index cc1382725..e78896582 100644 --- a/package-manager/README.md +++ b/package-manager/README.md @@ -36,6 +36,9 @@ docker run -it \ -p 4242:4242 \ -e RSPM_LICENSE=$RSPM_LICENSE \ rstudio/rstudio-package-manager:latest + +# Alternatively, the above can be ran using a single just command +just RSPM_LICENSE=XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX run ``` Open [http://localhost:4242](http://localhost:4242) to access RStudio Package Manager UI. diff --git a/r-session-complete/Justfile b/r-session-complete/Justfile new file mode 100755 index 000000000..0fc9aa51c --- /dev/null +++ b/r-session-complete/Justfile @@ -0,0 +1,74 @@ +set positional-arguments + +BUILDX_PATH := "" + +IMAGE_PREFIX := "" +PRODUCT := "r-session-complete" +IMAGE_OS := "bionic" + +RSW_VERSION := "2022.07.2+576.pro12" +RSW_TAG_SAFE_VERSION := replace(RSW_VERSION, "+", "-") +RSW_LICENSE := "" + +DRIVERS_VERSION := "2021.10.0" + +R_VERSION := "4.1.0" +R_VERSION_ALT := "3.6.2" + +PYTHON_VERSION := "3.9.5" +PYTHON_VERSION_ALT := "3.8.10" + +DEFAULT_TAG := IMAGE_PREFIX + PRODUCT + ":" + IMAGE_OS + "-" + RSW_TAG_SAFE_VERSION + +# Build r-session-complete image - just build bionic 2022.07.2+576.pro12 rstudio/r-session-complete:bionic-2022.07.2-576.pro12 +build OS=IMAGE_OS VERSION=RSW_VERSION +TAGS=DEFAULT_TAG: + #!/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 + tag_array=() + for TAG in {{TAGS}} + do + tag_array+=("-t" $TAG) + done + + docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \ + ${tag_array[@]} \ + --build-arg RSW_VERSION="{{ VERSION }}" \ + --build-arg DRIVERS_VERSION="{{ DRIVERS_VERSION }}" \ + --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 }}" \ + --file=./Dockerfile."{{ OS }}" . + +# Test r-session-complete image - just test rstudio/r-session-complete:bionic-2022.07.2-576.pro12 2022.07.2+576.pro12 +test TAG=DEFAULT_TAG VERSION=RSW_VERSION CMD="": + #!/usr/bin/env bash + set -euxo pipefail + IMAGE_NAME="{{ TAG }}" \ + RSW_VERSION="{{ VERSION }}" \ + R_VERSION="{{ R_VERSION }}" \ + R_VERSION_ALT="{{ R_VERSION_ALT }}" \ + PYTHON_VERSION="{{ PYTHON_VERSION }}" \ + PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \ + docker-compose -f ./docker-compose.test.yml run sut {{ CMD }} + +# Test r-session-complete image interactively - just test-i rstudio/r-session-complete:bionic-2022.07.2-576.pro12 2022.07.2+576.pro12 +test-i TAG=DEFAULT_TAG VERSION=RSW_VERSION: + just test {{ TAG }} {{ VERSION }} bash + +# Run r-session-complete - just run rstudio/r-session-complete:bionic-2022.07.2-576.pro12 +run TAG=DEFAULT_TAG CMD="": + #!/usr/bin/env bash + set -euxo pipefail + if [ -z "{{ RSW_LICENSE }}" ]; then + echo "Please set RSW_LICENSE to a valid RStudio Workbench license before running." + exit 1 + fi + docker run -it --privileged \ + -p 8788:8788 \ + -e RSW_LICENSE="{{ RSW_LICENSE }}" \ + "{{ TAG }}" {{ CMD }} diff --git a/r-session-complete/README.md b/r-session-complete/README.md index cca12d692..a0720f22a 100644 --- a/r-session-complete/README.md +++ b/r-session-complete/README.md @@ -36,7 +36,7 @@ Launcher, refer to the RStudio support article on [Using Docker images with RStudio Workbench, Launcher, and Kubernetes](https://support.rstudio.com/hc/en-us/articles/360019253393-Using-Docker-images-with-RStudio-Server-Pro-Launcher-and-Kubernetes). -We provide simple ways to extend and build off of the Dockerfiles. After you have cloned the repo, you can create your own containers fairly simply with the provided Makefile. +We provide simple ways to extend and build the Dockerfiles. After you have cloned the repo, you can create your own containers fairly simply with the provided Justfile. ## Docker Images on Docker Hub diff --git a/get-diffs.py b/tools/get-diffs.py similarity index 100% rename from get-diffs.py rename to tools/get-diffs.py diff --git a/get-version.py b/tools/get-version.py similarity index 96% rename from get-version.py rename to tools/get-version.py index b41125398..c263fe860 100755 --- a/get-version.py +++ b/tools/get-version.py @@ -26,18 +26,18 @@ import sys -def clean_product_version(version: str) -> str: +def clean_product_version(_version: str) -> str: """ Replace / alias "latest" with "release" - :type version: str + :type _version: str :rtype: str - :param version: The current version being used + :param _version: The current version being used :return: The cleaned/replaced version """ - if version == 'latest': - version = 'release' - return version + if _version == 'latest': + _version = 'release' + return _version def clean_product_selection(product: str) -> str: @@ -127,10 +127,10 @@ def get_local_release_version(product): else: raise ValueError(f'Invalid product {product}') - with open('Makefile', 'r') as f: + with open('Justfile', 'r') as f: content = f.read() - vers = re.compile(f'{prefix}_VERSION \?= (.*)') + vers = re.compile(f'{prefix}_VERSION := (.*)') res = vers.search(content) # from the first capture group output_version = res[1] @@ -185,7 +185,7 @@ def rstudio_pm_daily(): parser.add_argument( "--local", "-l", action="store_true", - help="Whether to use the 'local' version for 'release'. Parsed from the local Makefile", + help="Whether to use the 'local' version for 'release'. Parsed from the local Justfile.", ) parser.add_argument( "--override", "-o", diff --git a/workbench-for-microsoft-azure-ml/Justfile b/workbench-for-microsoft-azure-ml/Justfile new file mode 100644 index 000000000..405d73600 --- /dev/null +++ b/workbench-for-microsoft-azure-ml/Justfile @@ -0,0 +1,71 @@ +set positional-arguments + +BUILDX_PATH := "" + +IMAGE_PREFIX := "rstudio-" +PRODUCT := "workbench" +IMAGE_OS := "bionic" + +RSW_VERSION := "2022.07.2+576.pro12" +RSW_TAG_SAFE_VERSION := replace(RSW_VERSION, "+", "-") +RSW_LICENSE := "" + +R_VERSION := "3.6.2" +R_VERSION_ALT := "4.1.0" + +PYTHON_VERSION := "3.9.5" +PYTHON_VERSION_ALT := "3.8.10" + +DEFAULT_TAG := IMAGE_PREFIX + PRODUCT + ":" + IMAGE_OS + "-" + RSW_TAG_SAFE_VERSION + +# Build Workbench for Azure ML image - just build bionic 2022.07.2+576.pro12 rstudio/rstudio-workbench:bionic-2022.07.2-576.pro12 +build OS=IMAGE_OS VERSION=RSW_VERSION +TAGS=DEFAULT_TAG: + #!/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 + tag_array=() + for TAG in {{TAGS}} + do + tag_array+=("-t" $TAG) + done + + docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \ + ${tag_array[@]} \ + --build-arg RSW_VERSION="{{ VERSION }}" \ + --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 }}" \ + --file=./Dockerfile."{{ OS }}" . + +# Test Workbench for Azure ML image - just test rstudio/rstudio-workbench:bionic-2022.07.2-576.pro12 2022.07.2+576.pro12 +test TAG=DEFAULT_TAG VERSION=RSW_VERSION CMD="": + #!/usr/bin/env bash + set -euxo pipefail + IMAGE_NAME="{{ TAG }}" \ + RSW_VERSION="{{ VERSION }}" \ + R_VERSION="{{ R_VERSION }}" \ + R_VERSION_ALT="{{ R_VERSION_ALT }}" \ + PYTHON_VERSION="{{ PYTHON_VERSION }}" \ + PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \ + docker-compose -f ./docker-compose.test.yml run sut {{ CMD }} + +# Test Workbench for Azure ML image interactively - just test-i rstudio/rstudio-workbench:bionic-2022.07.2-576.pro12 2022.07.2+576.pro12 +test-i TAG=DEFAULT_TAG VERSION=RSW_VERSION: + just test {{ TAG }} {{ VERSION }} bash + +# Run Workbench for Azure ML - just RSW_LICENSE="" run rstudio/r-session-complete:bionic-2022.07.2-576.pro12 +run TAG=DEFAULT_TAG CMD="": + #!/usr/bin/env bash + set -euxo pipefail + if [ -z "{{ RSW_LICENSE }}" ]; then + echo "Please set RSW_LICENSE to a valid RStudio Workbench license before running." + exit 1 + fi + docker run -it --privileged \ + -p 8787:8787 \ + -e RSW_LICENSE="{{ RSW_LICENSE }}" \ + "{{ TAG }}" {{ CMD }} diff --git a/workbench-for-microsoft-azure-ml/README.md b/workbench-for-microsoft-azure-ml/README.md index 4989d9795..0b78a0f0e 100644 --- a/workbench-for-microsoft-azure-ml/README.md +++ b/workbench-for-microsoft-azure-ml/README.md @@ -1,3 +1,3 @@ # RStudio Workbench for Microsoft Azure ML -This container is built specifically for Azure ML +This container is built specifically for Azure ML. diff --git a/workbench/Justfile b/workbench/Justfile new file mode 100644 index 000000000..441ded61f --- /dev/null +++ b/workbench/Justfile @@ -0,0 +1,71 @@ +set positional-arguments + +BUILDX_PATH := "" + +IMAGE_PREFIX := "rstudio-" +PRODUCT := "workbench" +IMAGE_OS := "bionic" + +RSW_VERSION := "2022.07.2+576.pro12" +RSW_TAG_SAFE_VERSION := replace(RSW_VERSION, "+", "-") +RSW_LICENSE := "" + +R_VERSION := "3.6.2" +R_VERSION_ALT := "4.1.0" + +PYTHON_VERSION := "3.9.5" +PYTHON_VERSION_ALT := "3.8.10" + +DEFAULT_TAG := IMAGE_PREFIX + PRODUCT + ":" + IMAGE_OS + "-" + RSW_TAG_SAFE_VERSION + +# Build Workbench image - just build bionic 2022.07.2+576.pro12 rstudio/rstudio-workbench:bionic-2022.07.2-576.pro12 +build OS=IMAGE_OS VERSION=RSW_VERSION +TAGS=DEFAULT_TAG: + #!/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 + tag_array=() + for TAG in {{TAGS}} + do + tag_array+=("-t" $TAG) + done + + docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \ + ${tag_array[@]} \ + --build-arg RSW_VERSION="{{ VERSION }}" \ + --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 }}" \ + --file=./Dockerfile."{{ OS }}" . + +# Test Workbench image - just test rstudio/rstudio-workbench:bionic-2022.07.2-576.pro12 2022.07.2+576.pro12 +test TAG=DEFAULT_TAG VERSION=RSW_VERSION CMD="": + #!/usr/bin/env bash + set -euxo pipefail + IMAGE_NAME="{{ TAG }}" \ + RSW_VERSION="{{ VERSION }}" \ + R_VERSION="{{ R_VERSION }}" \ + R_VERSION_ALT="{{ R_VERSION_ALT }}" \ + PYTHON_VERSION="{{ PYTHON_VERSION }}" \ + PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \ + docker-compose -f ./docker-compose.test.yml run sut {{ CMD }} + +# Test Workbench image interactively - just test-i rstudio/rstudio-workbench:bionic-2022.07.2-576.pro12 2022.07.2+576.pro12 +test-i TAG=DEFAULT_TAG VERSION=RSW_VERSION: + just test {{ TAG }} {{ VERSION }} bash + +# Run Workbench - just RSW_LICENSE="" run rstudio/r-session-complete:bionic-2022.07.2-576.pro12 +run TAG=DEFAULT_TAG CMD="": + #!/usr/bin/env bash + set -euxo pipefail + if [ -z "{{ RSW_LICENSE }}" ]; then + echo "Please set RSW_LICENSE to a valid RStudio Workbench license before running." + exit 1 + fi + docker run -it --privileged \ + -p 8787:8787 \ + -e RSW_LICENSE="{{ RSW_LICENSE }}" \ + "{{ TAG }}" {{ CMD }} diff --git a/workbench/README.md b/workbench/README.md index 07e6dd070..24eb12079 100644 --- a/workbench/README.md +++ b/workbench/README.md @@ -28,9 +28,12 @@ docker run -it \ -p 8787:8787 \ -e RSW_LICENSE=$RSW_LICENSE \ rstudio/rstudio-workbench:latest + +# Alternatively, the above can be ran using a single just command +just RSW_LICENSE=XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX run ``` -Open http://localhost:8787 to access RStudio Workbench. The default username and password are _rstudio_. +Open http://localhost:8787 to access RStudio Workbench. The default username and password are `rstudio`. For a more "real" deployment, continue reading! @@ -40,13 +43,15 @@ Note that running the RStudio Workbench Docker image requires a valid RStudio Wo This container includes: -1. R 3.6.1 -2. Python 3.6.5 -3. RStudio Workbench +1. R 3.6 +2. R 4.1 +3. Python 3.8.10 +4. Python 3.9.5 +5. RStudio Workbench ### Configuration -RStudio Workbench is configured via config files in the in the `/etc/rstudio` directory. Mount this directory as +RStudio Workbench is configured via config files in the `/etc/rstudio` directory. Mount this directory as a volume from the host machine. Changes will take effect when the container is restarted. You can review possible RStudio Workbench configuration [in the documentation](https://docs.rstudio.com/ide/workbench/).