Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ For more about what is exported and imported by `sonar-config` please see the [s

Starting from version 3.4 `sonar-tools` is available as a docker image. Here is how to use the docker version:
```
docker pull sonar-tools:latest
docker pull olivierkorach/sonar-tools:latest
# Run `docker run sonar-tools` followed by your usual sonar-tools command with its parameters, and example below for sonar-loc
docker run --rm sonar-tools sonar-loc -u <YOUR_SONAR_URL> -t <YOUR_SONAR_TOKEN> <parameters>

Expand Down
9 changes: 8 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ while [ $# -ne 0 ]; do
pypi)
release=1
;;
dockerhub)
release_docker=1
;;
*)
;;
esac
Expand All @@ -48,7 +51,7 @@ python3 setup.py bdist_wheel
pip install --upgrade --force-reinstall dist/sonar_tools-*-py3-*.whl

if [ "$build_image" == "1" ]; then
docker build -t sonar-tools:latest .
docker build -t olivierkorach/sonar-tools:3.4 -t olivierkorach/sonar-tools:latest -f snapshot.Dockerfile .
fi

if [ "$build_docs" == "1" ]; then
Expand All @@ -63,4 +66,8 @@ if [ "$release" = "1" ]; then
if [ "$confirm" = "y" ]; then
python3 -m twine upload dist/sonar_tools-*-py3-*.whl
fi
fi

if [ "$release_docker" = "1" ]; then
docker buildx build --push --platform linux/amd64,linux/arm64 -t olivierkorach/sonar-tools:3.4 -t olivierkorach/sonar-tools:latest -f release.Dockerfile .
fi
39 changes: 39 additions & 0 deletions release.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM alpine:3.20.3
LABEL maintainer="[email protected]"
ENV IN_DOCKER="Yes"

ARG USERNAME=sonar
ARG USER_UID=1000
ARG GROUPNAME=sonar

# Create the user
RUN addgroup -S ${GROUPNAME} && adduser -u ${USER_UID} -S ${USERNAME} -G ${GROUPNAME}

# Install python/pip
ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python

# create a virtual environment and add it to PATH so that it is
# applied for all future RUN and CMD calls
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv ${VIRTUAL_ENV}
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"

WORKDIR /opt/sonar-tools

COPY ./sonar sonar
COPY ./requirements.txt .
COPY ./cli cli
COPY ./setup.py .
COPY ./sonar-tools .
COPY ./README.md .
COPY ./LICENSE .
COPY ./sonar/audit sonar/audit

RUN pip install --upgrade pip \
&& pip install sonar-tools==3.4

USER ${USERNAME}
WORKDIR /home/${USERNAME}

CMD [ "sonar-tools" ]
File renamed without changes.
1 change: 1 addition & 0 deletions test/test_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __test_config_cmd(arguments: list[str]) -> None:
assert util.file_not_empty(outputfile)
util.clean(outputfile)


def test_migration_help() -> None:
"""test_migration_help"""
util.clean(util.JSON_FILE)
Expand Down