Skip to content

Commit

Permalink
QD-4594 Set up contributing guide and bake for fast local builds
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Sep 4, 2023
1 parent 74aa0a3 commit 470649c
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# - name: Hadolint
# uses: hadolint/[email protected]
# with:
Expand Down
4 changes: 3 additions & 1 deletion 2023.2/android-community/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ARG BASE_TAG="bullseye-slim"
ARG NODE_TAG="16-bullseye-slim"
FROM node:$NODE_TAG AS node_base
FROM debian:$BASE_TAG

ENV HOME="/root" \
Expand Down Expand Up @@ -32,8 +34,8 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \

ENV GRADLE_USER_HOME="/data/cache/gradle"

ARG QD_BUILD="QDANDC-2023.2"
ARG QD_RELEASE="2023.2"
ARG QD_BUILD="QDANDC-$QD_RELEASE"
# hadolint ignore=DL3003,SC2043
RUN set -ex && \
dpkgArch="$(dpkg --print-architecture)" && \
Expand Down
7 changes: 3 additions & 4 deletions 2023.2/dotnet/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
ARG NODE_TAG="16-bullseye-slim"
ARG BASE_TAG="6.0-bullseye-slim"

ARG DOTNET_BASE_TAG="6.0-bullseye-slim"
FROM node:$NODE_TAG AS node_base
FROM mcr.microsoft.com/dotnet/sdk:$BASE_TAG
FROM mcr.microsoft.com/dotnet/sdk:$DOTNET_BASE_TAG

ENV HOME="/root" \
LC_ALL="en_US.UTF-8" \
Expand Down Expand Up @@ -63,8 +62,8 @@ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
npm install -g [email protected] [email protected] && npm config set update-notifier false && \
chmod 777 -R "$HOME/.npm" "$HOME/.npmrc"

ARG QD_BUILD="QDNET-2023.2"
ARG QD_RELEASE="2023.2"
ARG QD_BUILD="QDNET-$QD_RELEASE"
# hadolint ignore=DL3003,SC2043
RUN set -ex && \
dpkgArch="$(dpkg --print-architecture)" && \
Expand Down
7 changes: 3 additions & 4 deletions 2023.2/go/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
ARG GO_TAG="1.19-bullseye"
ARG NODE_TAG="16-bullseye-slim"
ARG BASE_TAG="1.19-bullseye"

FROM node:$NODE_TAG AS node_base
FROM golang:$BASE_TAG
FROM golang:$GO_TAG

ENV HOME="/root" \
LC_ALL="en_US.UTF-8" \
Expand Down Expand Up @@ -47,8 +46,8 @@ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
npm install -g [email protected] [email protected] && npm config set update-notifier false && \
chmod 777 -R "$HOME/.npm" "$HOME/.npmrc"

ARG QD_BUILD="QDGO-2023.2"
ARG QD_RELEASE="2023.2"
ARG QD_BUILD="QDGO-$QD_RELEASE"
# hadolint ignore=DL3003,SC2043
RUN set -ex && \
dpkgArch="$(dpkg --print-architecture)" && \
Expand Down
6 changes: 3 additions & 3 deletions 2023.2/js/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_TAG="16-bullseye-slim"
FROM node:$BASE_TAG
ARG NODE_TAG="16-bullseye-slim"
FROM node:$NODE_TAG

ENV HOME="/root" \
LC_ALL="en_US.UTF-8" \
Expand Down Expand Up @@ -34,8 +34,8 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \

ENV PATH="/opt/yarn/bin:$PATH"

ARG QD_BUILD="QDJVM-2023.2"
ARG QD_RELEASE="2023.2"
ARG QD_BUILD="QDJVM-$QD_RELEASE"
# hadolint ignore=DL3003,SC2043
RUN set -ex && \
dpkgArch="$(dpkg --print-architecture)" && \
Expand Down
4 changes: 3 additions & 1 deletion 2023.2/jvm-community/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ARG BASE_TAG="bullseye-slim"
ARG NODE_TAG="16-bullseye-slim"
FROM node:$NODE_TAG AS node_base
FROM debian:$BASE_TAG

ENV HOME="/root" \
Expand Down Expand Up @@ -32,8 +34,8 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \

ENV GRADLE_USER_HOME="/data/cache/gradle"

ARG QD_BUILD="QDJVMC-2023.2"
ARG QD_RELEASE="2023.2"
ARG QD_BUILD="QDJVMC-$QD_RELEASE"
# hadolint ignore=DL3003,SC2043
RUN set -ex && \
dpkgArch="$(dpkg --print-architecture)" && \
Expand Down
12 changes: 7 additions & 5 deletions 2023.2/jvm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ARG BASE_TAG="bullseye-slim"
ARG NODE_TAG="16-bullseye-slim"
FROM node:$NODE_TAG AS node_base
FROM debian:$BASE_TAG

ENV HOME="/root" \
Expand Down Expand Up @@ -31,10 +33,10 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
git config --global --add safe.directory '*'

ENV PATH="/opt/yarn/bin:$PATH"
COPY --from=node:16-bullseye-slim /usr/local/bin/node /usr/local/bin/
COPY --from=node:16-bullseye-slim /usr/local/include/node /usr/local/include/node
COPY --from=node:16-bullseye-slim /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node:16-bullseye-slim /opt/yarn-* /opt/yarn/
COPY --from=node_base /usr/local/bin/node /usr/local/bin/
COPY --from=node_base /usr/local/include/node /usr/local/include/node
COPY --from=node_base /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node_base /opt/yarn-* /opt/yarn/
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \
ln -s /usr/local/lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack && \
Expand All @@ -46,8 +48,8 @@ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \

ENV GRADLE_USER_HOME="/data/cache/gradle"

ARG QD_BUILD="QDJVM-2023.2"
ARG QD_RELEASE="2023.2"
ARG QD_BUILD="QDJVM-$QD_RELEASE"
# hadolint ignore=DL3003,SC2043
RUN set -ex && \
dpkgArch="$(dpkg --print-architecture)" && \
Expand Down
19 changes: 10 additions & 9 deletions 2023.2/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
ARG NODE_TAG="16-bullseye-slim"
ARG BASE_TAG="8.1-cli-bullseye"

ARG PHP_TAG="8.1-cli-bullseye"
ARG COMPOSER_TAG="2.5.1"
FROM node:$NODE_TAG AS node_base
FROM php:$BASE_TAG
FROM composer:$COMPOSER_TAG AS composer_base
FROM php:$PHP_TAG

ENV HOME="/root" \
LC_ALL="en_US.UTF-8" \
Expand Down Expand Up @@ -35,10 +36,10 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
git config --global --add safe.directory '*'

ENV PATH="/opt/yarn/bin:$PATH"
COPY --from=node:16-bullseye-slim /usr/local/bin/node /usr/local/bin/
COPY --from=node:16-bullseye-slim /usr/local/include/node /usr/local/include/node
COPY --from=node:16-bullseye-slim /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node:16-bullseye-slim /opt/yarn-* /opt/yarn/
COPY --from=node_base /usr/local/bin/node /usr/local/bin/
COPY --from=node_base /usr/local/include/node /usr/local/include/node
COPY --from=node_base /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node_base /opt/yarn-* /opt/yarn/
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \
ln -s /usr/local/lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack && \
Expand All @@ -48,10 +49,10 @@ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
npm install -g [email protected] [email protected] && npm config set update-notifier false && \
chmod 777 -R "$HOME/.npm" "$HOME/.npmrc"

COPY --from=composer:2.5.1 /usr/bin/composer /usr/bin/composer
COPY --from=composer_base /usr/bin/composer /usr/bin/composer

ARG QD_BUILD="QDPHP-2023.2"
ARG QD_RELEASE="2023.2"
ARG QD_BUILD="QDPHP-$QD_RELEASE"
# hadolint ignore=DL3003,SC2043
RUN set -ex && \
dpkgArch="$(dpkg --print-architecture)" && \
Expand Down
4 changes: 3 additions & 1 deletion 2023.2/python-community/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ARG BASE_TAG="bullseye-slim"
ARG NODE_TAG="16-bullseye-slim"
FROM node:$NODE_TAG AS node_base
FROM debian:$BASE_TAG

ENV HOME="/root" \
Expand Down Expand Up @@ -70,8 +72,8 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
${CONDA_DIR}/bin/conda install -c conda-forge poetry pipenv && ${CONDA_DIR}/bin/conda clean -afy && \
rm -rf /tmp/*

ARG QD_BUILD="QDPYC-2023.2"
ARG QD_RELEASE="2023.2"
ARG QD_BUILD="QDPYC-$QD_RELEASE"
# hadolint ignore=DL3003,SC2043
RUN set -ex && \
dpkgArch="$(dpkg --print-architecture)" && \
Expand Down
12 changes: 7 additions & 5 deletions 2023.2/python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ARG BASE_TAG="bullseye-slim"
ARG NODE_TAG="16-bullseye-slim"
FROM node:$NODE_TAG AS node_base
FROM debian:$BASE_TAG

ENV HOME="/root" \
Expand Down Expand Up @@ -71,10 +73,10 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
rm -rf /tmp/*

ENV PATH="/opt/yarn/bin:$PATH"
COPY --from=node:16-bullseye-slim /usr/local/bin/node /usr/local/bin/
COPY --from=node:16-bullseye-slim /usr/local/include/node /usr/local/include/node
COPY --from=node:16-bullseye-slim /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node:16-bullseye-slim /opt/yarn-* /opt/yarn/
COPY --from=node_base /usr/local/bin/node /usr/local/bin/
COPY --from=node_base /usr/local/include/node /usr/local/include/node
COPY --from=node_base /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node_base /opt/yarn-* /opt/yarn/
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \
ln -s /usr/local/lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack && \
Expand All @@ -84,8 +86,8 @@ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
npm install -g [email protected] [email protected] && npm config set update-notifier false && \
chmod 777 -R "$HOME/.npm" "$HOME/.npmrc"

ARG QD_BUILD="QDPY-2023.2"
ARG QD_RELEASE="2023.2"
ARG QD_BUILD="QDPY-$QD_RELEASE"
# hadolint ignore=DL3003,SC2043
RUN set -ex && \
dpkgArch="$(dpkg --print-architecture)" && \
Expand Down
8 changes: 0 additions & 8 deletions 2023.2/run-tests.sh

This file was deleted.

35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Contributing

By participating in this project, you agree to abide our [Code of conduct](.github/CODE_OF_CONDUCT.md).

## Set up your machine

Prerequisites:

- [Docker](https://docs.docker.com/get-docker/)

Other things you might need to develop:

- [IntelliJ IDEA](https://www.jetbrains.com/idea/) (it's [free for open-source development](https://www.jetbrains.com/community/opensource/))

Clone the project anywhere:

```sh
git clone [email protected]:JetBrains/qodana-docker.git
```

`cd` into the directory, with [Docker Bake](https://docs.docker.com/build/bake/) you can build all images at once:

```shell
docker buildx bake
```

## Create a commit

Commit messages should be well formatted, and to make that "standardized", we are using [internal issue tracker](https://youtrack.jetbrains.com) references.


## Submit a pull request

Push your branch to your repository fork and open a pull request against the
main branch.
25 changes: 25 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
group "default" {
targets = ["232"]
}

target "232" {
name = "qodana-${edition}"
matrix = {
edition = ["android-community", "dotnet", "go", "js", "jvm", "jvm-community", "php", "python", "python-community"]
version = ["2023.2"]
}
args = {
QD_RELEASE = "2023.2"
BASE_TAG = "bullseye-slim"
DOTNET_TAG = "6.0-bullseye-slim"
GO_TAG = "1.19-bullseye"
NODE_TAG = "16-bullseye-slim"
PHP_TAG = "8.1-cli-bullseye"
COMPOSER_TAG="2.5.1"
}
tags = [
"docker.io/jetbrains/qodana:${edition}-${version}-latest"
]
# platforms = ["linux/amd64", "linux/arm64"] // uncomment to build for multiple platforms, but it will take more time
dockerfile = "${version}/${edition}/Dockerfile"
}

0 comments on commit 470649c

Please sign in to comment.