├── .github └── workflows │ ├── go_build_snapshot_docker_and_push.yml │ ├── go_master_build_and_push.yml │ ├── idea_release_build_and_push.yml │ └── idea_snapshot_build_and_push.yml ├── .gitignore ├── LICENSE ├── README.md ├── build └── build_and_push_docker_container.sh ├── images ├── Dockerfile-goland └── Dockerfile-idea ├── run_scripts └── run_shared_index.sh ├── versions-goland.properties └── versions-idea.properties /.github/workflows/go_build_snapshot_docker_and_push.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | name: Goland. Build Docker images for all Intellij Goland versions 3 | 4 | # Controls when the workflow will run 5 | on: 6 | # Triggers the workflow on push or pull request events but only for the master branch 7 | push: 8 | branches: [ develop ] 9 | paths-ignore: 10 | - 'README.md' 11 | pull_request: 12 | branches: [ develop ] 13 | paths-ignore: 14 | - 'README.md' 15 | 16 | # Allows you to run this workflow manually from the Actions tab 17 | workflow_dispatch: 18 | 19 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 20 | jobs: 21 | # This workflow contains a single job called "build" 22 | build: 23 | # The type of runner that the job will run on 24 | runs-on: ubuntu-latest 25 | 26 | # Steps represent a sequence of tasks that will be executed as part of the job 27 | steps: 28 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 29 | - uses: actions/checkout@v2 30 | 31 | - name: Login to Docker Hub 32 | uses: docker/login-action@v1 33 | with: 34 | username: ${{ secrets.DOCKERHUB_USERNAME }} 35 | password: ${{ secrets.DOCKERHUB_TOKEN }} 36 | 37 | - name: Goland. Build Docker images for all Intellij Idea Ultimate versions 38 | run: | 39 | chmod +x ./build/build_and_push_docker_container.sh 40 | ./build/build_and_push_docker_container.sh -p docker.io -d goland 41 | 42 | 43 | - name: Login to GHCR Hub 44 | uses: docker/login-action@v1 45 | with: 46 | registry: ghcr.io 47 | username: ${{ github.actor }} 48 | password: ${{ secrets.GITHUB_TOKEN }} 49 | 50 | # Runs a set of commands using the runners shell 51 | - name: Build Docker images for all Goland versions and push to ghcr.io 52 | run: | 53 | chmod +x ./build/build_and_push_docker_container.sh 54 | ./build/build_and_push_docker_container.sh -p ghcr.io -d goland 55 | -------------------------------------------------------------------------------- /.github/workflows/go_master_build_and_push.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | name: Go. Release. Build Docker images for all Goland versions 3 | 4 | # Controls when the workflow will run 5 | on: 6 | # Triggers the workflow on push or pull request events but only for the master branch 7 | push: 8 | branches: [ master ] 9 | 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 14 | jobs: 15 | # This workflow contains a single job called "build" 16 | build: 17 | # The type of runner that the job will run on 18 | runs-on: ubuntu-latest 19 | 20 | # Steps represent a sequence of tasks that will be executed as part of the job 21 | steps: 22 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 23 | - uses: actions/checkout@v2 24 | 25 | - name: Login to Docker Hub 26 | uses: docker/login-action@v1 27 | with: 28 | username: ${{ secrets.DOCKERHUB_USERNAME }} 29 | password: ${{ secrets.DOCKERHUB_TOKEN }} 30 | 31 | # Runs a set of commands using the runners shell 32 | - name: Go. Build Docker images for all Goland versions 33 | run: | 34 | chmod +x ./build/build_and_push_docker_container.sh 35 | ./build/build_and_push_docker_container.sh -p docker.io -d goland 36 | 37 | 38 | - name: Login to GHCR Hub 39 | uses: docker/login-action@v1 40 | with: 41 | registry: ghcr.io 42 | username: ${{ github.actor }} 43 | password: ${{ secrets.GITHUB_TOKEN }} 44 | 45 | # Runs a set of commands using the runners shell 46 | - name: Build Docker images for all Goland versions and push to ghcr.io 47 | run: | 48 | chmod +x ./build/build_and_push_docker_container.sh 49 | ./build/build_and_push_docker_container.sh -p ghcr.io -d goland -------------------------------------------------------------------------------- /.github/workflows/idea_release_build_and_push.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | name: Build Released Docker images for Idea Ultimate 3 | 4 | # Controls when the workflow will run 5 | on: 6 | # Triggers the workflow on push or pull request events but only for the master branch 7 | push: 8 | branches: [ master ] 9 | 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 14 | jobs: 15 | # This workflow contains a single job called "build" 16 | build: 17 | # The type of runner that the job will run on 18 | runs-on: ubuntu-latest 19 | 20 | # Steps represent a sequence of tasks that will be executed as part of the job 21 | steps: 22 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 23 | - uses: actions/checkout@v2 24 | 25 | - name: Login to Docker Hub 26 | uses: docker/login-action@v1 27 | with: 28 | username: ${{ secrets.DOCKERHUB_USERNAME }} 29 | password: ${{ secrets.DOCKERHUB_TOKEN }} 30 | 31 | 32 | # Runs a set of commands using the runners shell 33 | - name: Build Docker images for all Intellij Idea Ultimate versions 34 | run: | 35 | chmod +x ./build/build_and_push_docker_container.sh 36 | ./build/build_and_push_docker_container.sh -v RELEASE -p docker.io -d idea 37 | 38 | 39 | - name: Login to GHCR Hub 40 | uses: docker/login-action@v1 41 | with: 42 | registry: ghcr.io 43 | username: ${{ github.actor }} 44 | password: ${{ secrets.GITHUB_TOKEN }} 45 | 46 | # Runs a set of commands using the runners shell 47 | - name: Build Docker images for all Idea Ultimate versions and push to ghcr.io 48 | run: | 49 | chmod +x ./build/build_and_push_docker_container.sh 50 | ./build/build_and_push_docker_container.sh -v RELEASE -p ghcr.io -d idea 51 | -------------------------------------------------------------------------------- /.github/workflows/idea_snapshot_build_and_push.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | name: Build Snapshot Docker images for Idea Ultimate 3 | 4 | #todo possible improvement https://github.com/docker/build-push-action/blob/master/docs/advanced/share-image-jobs.md 5 | 6 | # Controls when the workflow will run 7 | on: 8 | # Triggers the workflow on push or pull request events but only for the master branch 9 | push: 10 | branches: [ develop ] 11 | paths-ignore: 12 | - 'README.md' 13 | pull_request: 14 | branches: [ develop ] 15 | paths-ignore: 16 | - 'README.md' 17 | 18 | # Allows you to run this workflow manually from the Actions tab 19 | workflow_dispatch: 20 | 21 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 22 | jobs: 23 | # This workflow contains a single job called "build" 24 | build: 25 | # The type of runner that the job will run on 26 | runs-on: ubuntu-latest 27 | 28 | # Steps represent a sequence of tasks that will be executed as part of the job 29 | steps: 30 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 31 | - uses: actions/checkout@v2 32 | 33 | - name: Login to Docker Hub 34 | uses: docker/login-action@v1 35 | with: 36 | username: ${{ secrets.DOCKERHUB_USERNAME }} 37 | password: ${{ secrets.DOCKERHUB_TOKEN }} 38 | 39 | # Runs a set of commands using the runners shell 40 | - name: Build Docker images for all Intellij Idea Ultimate versions 41 | run: | 42 | chmod +x ./build/build_and_push_docker_container.sh 43 | ./build/build_and_push_docker_container.sh -p docker.io -d idea 44 | 45 | 46 | - name: Login to GHCR Hub 47 | uses: docker/login-action@v1 48 | with: 49 | registry: ghcr.io 50 | username: ${{ github.actor }} 51 | password: ${{ secrets.GITHUB_TOKEN }} 52 | 53 | # Runs a set of commands using the runners shell 54 | - name: Build Docker images for all Intellij Idea Ultimate versions 55 | run: | 56 | chmod +x ./build/build_and_push_docker_container.sh 57 | ./build/build_and_push_docker_container.sh -p ghcr.io -d idea 58 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | ### STS ### 3 | .apt_generated 4 | .classpath 5 | .factorypath 6 | .project 7 | .settings 8 | .springBeans 9 | .sts4-cache 10 | 11 | ### IntelliJ IDEA ### 12 | .idea 13 | *.iws 14 | *.iml 15 | *.ipr 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Andrey Damintsev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # idea-shared-index-dockerfile 2 | 3 | [![Idea Docker images build](https://github.com/damintsew/idea-shared-index-dockerfile/actions/workflows/idea_release_build_and_push.yml/badge.svg?branch=master)](https://github.com/damintsew/idea-shared-index-dockerfile/actions/workflows/idea_release_build_and_push.yml) 4 | [![Goland Docker images build](https://github.com/damintsew/idea-shared-index-dockerfile/actions/workflows/go_master_build_and_push.yml/badge.svg?branch=master)](https://github.com/damintsew/idea-shared-index-dockerfile/actions/workflows/go_master_build_and_push.yml) 5 | 6 | The repository contains Dockerfile for building Intellij Idea images that will be used for generating **project** shared indexes 7 | by `dump-shared-index project` command. 8 | 9 | 10 | # Run parameters 11 | To build shared indexes you have to provide properties `PROJECT_ID`, `COMMIT_ID` map source directory and directory with the resuls. 12 | Where: 13 | - `COMMIT_ID` will be used by Idea to find an appropriate index. 14 | - `PROJECT_ID` should be the unique Id of the project the same that in `intellij.yaml`. 15 | - Map source folder. Internally there is `IDEA_PROJECT_DIR` which is hardcoded to `/var/project` and should be mapped by `docker volumes` 16 | - Map folder with the results of generating indexes. Internally is hardcoded to `/shared-index/output` and should be mapped by `docker volumes` 17 | 18 | 19 | # How to use 20 | 21 | 1. Download image `docker pull damintsew/idea-indexer-2021.3`. 22 | 2. Run image `docker run -v YOUR_PROJECT_DIR:/var/project -v GENERATED_OUTPUD_DIR:/shared-index/output 23 | -e COMMIT_ID= -e PROJECT_ID=` 24 | 25 | For example: //todo 26 | 27 | # How to build 28 | ``` 29 | INTELLIJ_VERSION= 30 | docker build . --build-arg INTELLIJ_VERSION=${INTELLIJ_VERSION} -t damintsew/idea-indexer-${INTELLIJ_VERSION} 31 | ``` 32 | Currently, there are several docker images for different Intellij Idea versions: 33 | 34 | | Intellij Idea Version. Image tag: damintsew/idea-indexer-${version} | Goland Idea version. Image tag: damintsew/goland-indexer-${version} | 35 | |:---------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| 36 | | | [2021.3.2](https://hub.docker.com/repository/docker/damintsew/goland-indexer-2021.3.2]) | 37 | | [2021.3.1](https://hub.docker.com/repository/docker/damintsew/idea-indexer-2021.3.1]) | [2021.3.1](https://hub.docker.com/repository/docker/damintsew/goland-indexer-2021.3.1]) | 38 | | [2021.3](https://hub.docker.com/repository/docker/damintsew/idea-indexer-2021.3]) | [2021.2.3](https://hub.docker.com/repository/docker/damintsew/goland-indexer-2021.2.3]) | 39 | | [2021.2.3](https://hub.docker.com/repository/docker/damintsew/idea-indexer-2021.2.3]) | [2021.2.2](https://hub.docker.com/repository/docker/damintsew/goland-indexer-2021.2.2]) | 40 | | [2021.2.2](https://hub.docker.com/repository/docker/damintsew/idea-indexer-2021.2.2]) | [2021.1.1](https://hub.docker.com/repository/docker/damintsew/goland-indexer-2021.2.1]) | 41 | | [2021.2.1](https://hub.docker.com/repository/docker/damintsew/idea-indexer-2021.2.1]) | | 42 | -------------------------------------------------------------------------------- /build/build_and_push_docker_container.sh: -------------------------------------------------------------------------------- 1 | 2 | echo "Start" 3 | 4 | while getopts "v:p:d:" opt 5 | do 6 | case "$opt" in 7 | v ) SNAPSHOT_SUFFIX="$OPTARG" ;; 8 | p ) DOCKER_PROVIDER="$OPTARG" ;; 9 | d ) DOCKERFILE="$OPTARG" ;; 10 | ? ) echo "todo print help" # https://unix.stackexchange.com/questions/31414/how-can-i-pass-a-command-line-argument-into-a-shell-script 11 | esac 12 | done 13 | 14 | if [ -z "${SNAPSHOT_SUFFIX}" ]; then 15 | SNAPSHOT_SUFFIX='-snapshot' 16 | else 17 | SNAPSHOT_SUFFIX="" 18 | fi 19 | 20 | filename=./versions-${DOCKERFILE}.properties 21 | 22 | while read VERSION_INDEX; do 23 | 24 | IMAGE_NAME=${DOCKER_PROVIDER}/damintsew/indexer-${DOCKERFILE}-${VERSION_INDEX}${SNAPSHOT_SUFFIX} 25 | echo "Build image for version $IMAGE_NAME" 26 | echo "CMD: docker build --build-arg INTELLIJ_VERSION=""${VERSION_INDEX}"" --file images/Dockerfile-${DOCKERFILE} --tag ""${IMAGE_NAME}"" ." 27 | 28 | docker build --build-arg INTELLIJ_VERSION="${VERSION_INDEX}" --file images/Dockerfile-${DOCKERFILE} \ 29 | --tag "${IMAGE_NAME}" . 30 | 31 | echo "Push image for version $IMAGE_NAME" 32 | docker push "$IMAGE_NAME" 33 | 34 | done < "$filename" 35 | -------------------------------------------------------------------------------- /images/Dockerfile-goland: -------------------------------------------------------------------------------- 1 | FROM openkbs/jdk-mvn-py3 2 | 3 | ARG INTELLIJ_VERSION 4 | ARG INTELLIJ_IDE_TAR=goland-${INTELLIJ_VERSION}.tar.gz 5 | 6 | ENV COMMIT_ID='' 7 | ENV PROJECT_ID='' 8 | ENV IDEA_PROPERTIES=/opt/idea/bin/idea.properties 9 | ENV IDEA_PROJECT_DIR="/var/project" 10 | ENV SHARED_INDEX_BASE="/shared-index" 11 | 12 | USER root 13 | WORKDIR /opt 14 | 15 | RUN mkdir -p /etc/idea && \ 16 | mkdir -p /etc/idea/config && \ 17 | mkdir -p /etc/idea/log && \ 18 | mkdir -p /etc/idea/system && \ 19 | mkdir ${SHARED_INDEX_BASE} && \ 20 | mkdir ${SHARED_INDEX_BASE}/output && \ 21 | mkdir ${SHARED_INDEX_BASE}/temp 22 | 23 | RUN wget https://download.jetbrains.com/go/${INTELLIJ_IDE_TAR} -nv && \ 24 | tar xzf ${INTELLIJ_IDE_TAR} && \ 25 | tar tzf ${INTELLIJ_IDE_TAR} | head -1 | sed -e 's/\/.*//' | xargs -I{} ln -s {} idea && \ 26 | rm ${INTELLIJ_IDE_TAR} && \ 27 | echo idea.config.path=/etc/idea/config >> /opt/idea/bin/idea.properties && \ 28 | echo idea.log.path=/etc/idea/log >> /opt/idea/bin/idea.properties && \ 29 | echo idea.system.path=/etc/idea/system >> /opt/idea/bin/idea.properties && \ 30 | chmod -R 777 /opt/idea && \ 31 | chmod -R 777 ${SHARED_INDEX_BASE} && \ 32 | chmod -R 777 /etc/idea 33 | 34 | CMD /opt/idea/bin/goland.sh dump-shared-index project \ 35 | --project-dir=${IDEA_PROJECT_DIR} \ 36 | --project-id=${PROJECT_ID} \ 37 | --commit-id=${COMMIT_ID} \ 38 | --tmp=${SHARED_INDEX_BASE}/temp \ 39 | --output=${SHARED_INDEX_BASE}/output 40 | -------------------------------------------------------------------------------- /images/Dockerfile-idea: -------------------------------------------------------------------------------- 1 | FROM openkbs/jdk-mvn-py3 2 | 3 | ENV COMMIT_ID='' 4 | ENV PROJECT_ID='' 5 | ENV IDEA_PROPERTIES=/opt/idea/bin/idea.properties 6 | ENV PROJECT_DIR="/var/project" 7 | ENV SHARED_INDEX_BASE="/shared-index" 8 | 9 | USER root 10 | WORKDIR /opt 11 | 12 | RUN apt-get update && apt-get install -y \ 13 | zip \ 14 | && rm -rf /var/lib/apt/lists/* 15 | 16 | RUN mkdir -p /etc/idea && \ 17 | mkdir -p /etc/idea/config && \ 18 | mkdir -p /etc/idea/log && \ 19 | mkdir -p /etc/idea/system && \ 20 | mkdir ${SHARED_INDEX_BASE} && \ 21 | mkdir ${SHARED_INDEX_BASE}/output && \ 22 | mkdir ${SHARED_INDEX_BASE}/temp 23 | 24 | ARG INTELLIJ_VERSION 25 | ARG INTELLIJ_IDE_TAR=ideaIU-${INTELLIJ_VERSION}.tar.gz 26 | 27 | RUN wget https://download-cf.jetbrains.com/idea/${INTELLIJ_IDE_TAR} -nv && \ 28 | tar xzf ${INTELLIJ_IDE_TAR} && \ 29 | tar tzf ${INTELLIJ_IDE_TAR} | head -1 | sed -e 's/\/.*//' | xargs -I{} ln -s {} idea && \ 30 | rm ${INTELLIJ_IDE_TAR} && \ 31 | echo idea.config.path=/etc/idea/config >> /opt/idea/bin/idea.properties && \ 32 | echo idea.log.path=/etc/idea/log >> /opt/idea/bin/idea.properties && \ 33 | echo idea.system.path=/etc/idea/system >> /opt/idea/bin/idea.properties && \ 34 | chmod -R 777 /opt/idea && \ 35 | chmod -R 777 ${SHARED_INDEX_BASE} && \ 36 | chmod -R 777 /etc/idea 37 | 38 | COPY run_scripts/run_shared_index.sh . 39 | RUN chmod +x run_shared_index.sh 40 | 41 | CMD ./run_shared_index.sh 42 | -------------------------------------------------------------------------------- /run_scripts/run_shared_index.sh: -------------------------------------------------------------------------------- 1 | #echo `git status` 2 | 3 | echo "Start" 4 | 5 | #while getopts "c:p:" opt 6 | #do 7 | # case "$opt" in 8 | # v ) COMMIT_ID="$OPTARG" ;; 9 | # p ) PROJECT_ID="$OPTARG" ;; 10 | # ? ) echo "todo print help" # https://unix.stackexchange.com/questions/31414/how-can-i-pass-a-command-line-argument-into-a-shell-script 11 | # esac 12 | #done 13 | 14 | /opt/idea/bin/idea.sh dump-shared-index project \ 15 | --project-dir=${PROJECT_DIR} \ 16 | --project-id=${PROJECT_ID} \ 17 | --commit-id=${COMMIT_ID} \ 18 | --tmp=${SHARED_INDEX_BASE}/temp \ 19 | --output=${SHARED_INDEX_BASE}/output 20 | 21 | # Format for CDN (cdn-layout-tool) 22 | if [ ! -z "$INDEXES_CDN_URL" ]; then 23 | # echo "Formatting indexes" 24 | # /opt/cdn-layout-tool/bin/cdn-layout-tool \ 25 | # --indexes-dir=${SHARED_INDEX_BASE} \ 26 | # --url=${INDEXES_CDN_URL} && \ 27 | # mv ${SHARED_INDEX_BASE}/output ${SHARED_INDEX_BASE}/project/output 28 | 29 | # Zip files. Prepare for sending 30 | echo "Zipping output" 31 | cd ${SHARED_INDEX_BASE}/output && zip -r /opt/zipped_index.zip ./* && cd - 32 | 33 | echo "Sending output to Server" 34 | curl -X POST "${INDEXES_CDN_URL}/manage/upload?commitId=${COMMIT_ID}&projectId=${PROJECT_ID}" \ 35 | -H "accept: */*" \ 36 | -H "Content-Type: multipart/form-data" \ 37 | -F "file=@/opt/zipped_index.zip" 38 | 39 | echo "Index successfully sended to server ${INDEXES_CDN_URL}" 40 | echo "Removing zipped_index.zip" 41 | rm /opt/zipped_index.zip 42 | rm /${SHARED_INDEX_BASE}/output/* 43 | fi 44 | -------------------------------------------------------------------------------- /versions-goland.properties: -------------------------------------------------------------------------------- 1 | 2021.3.2 2 | 2021.3.1 3 | 2021.2.3 4 | 2021.2.2 5 | 2021.2.1 -------------------------------------------------------------------------------- /versions-idea.properties: -------------------------------------------------------------------------------- 1 | 2022.1 2 | 2021.3.3 3 | 2021.3.2 4 | 2021.3.1 5 | 2021.3 6 | 2021.2.3 7 | 2021.2.2 8 | 2021.2.1 9 | 2021.2 10 | --------------------------------------------------------------------------------