Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Forked from Ichlasul Affan / Sonar Scanner CLI Image for Flutter
Up to date with the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Dockerfile 3.29 KiB
FROM jro7/flutter_lcov:latest

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Setup workspace folder
RUN mkdir -p /workspace && chown -R $(whoami):$(whoami) /workspace
WORKDIR /workspace

# Install packages
RUN apt-get update \
    && apt-get -y install --no-install-recommends ca-certificates git nodejs unzip wget xz-utils \
    # Clean up
    && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/lists/*

# Configure Sonar Scanner CLI
ARG SONAR_SCANNER_CLI_VERSION=4.6.0.2311
RUN wget -qO sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_CLI_VERSION-linux.zip \
    && unzip sonar-scanner-cli.zip -d /opt \
    && chown -R $(whoami):$(whoami) /opt/sonar-scanner-$SONAR_SCANNER_CLI_VERSION-linux \
    && rm sonar-scanner-cli.zip \
    && chmod +x /opt/sonar-scanner-$SONAR_SCANNER_CLI_VERSION-linux/bin/sonar-scanner \
    && ln -s /opt/sonar-scanner-$SONAR_SCANNER_CLI_VERSION-linux/bin/sonar-scanner /usr/local/bin/sonar-scanner

# Configure shellcheck
ARG SHELLCHECK_VERSION=latest
RUN wget -qO /opt/shellcheck-${SHELLCHECK_VERSION}.tar.xz https://shellcheck.storage.googleapis.com/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz \
    && cd /opt \
    && tar -xf shellcheck-${SHELLCHECK_VERSION}.tar.xz \
    && chown -R $(whoami):$(whoami) /opt/shellcheck-${SHELLCHECK_VERSION} \
    && rm shellcheck-${SHELLCHECK_VERSION}.tar.xz \
    && chmod +x /opt/shellcheck-${SHELLCHECK_VERSION}/shellcheck \
    && ln -s /opt/shellcheck-${SHELLCHECK_VERSION}/shellcheck /usr/local/bin/shellcheck

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=''

# Define default command to be run
CMD ["sonar-scanner"]

# Container image metadata
## Note to editors: metadata values for `created`, `version`, and `revision`
## keys must be provided during build process, i.e. `docker build` invocation.
## It is also possible to pass other metadata values via build arguments.
ARG IMAGE_CREATED=""
ARG IMAGE_SOURCE="https://gitlab.cs.ui.ac.id/ichlasul.affan/sonar-scanner-cli-flutter-image"
ARG IMAGE_VERSION=${SONAR_SCANNER_CLI_VERSION}
ARG IMAGE_REVISION=""
ARG IMAGE_VENDOR="Faculty of Computer Science Universitas Indonesia"
ARG IMAGE_TITLE="Sonar Scanner CLI Image for Flutter"
ARG IMAGE_DESCRIPTION="Sonar Scanner CLI with Flutter dependencies bundled in a container image."
LABEL org.opencontainers.image.created=${IMAGE_CREATED} \
      org.opencontainers.image.authors=${IMAGE_AUTHOR} \
      org.opencontainers.image.source=${IMAGE_SOURCE} \
      org.opencontainers.image.version=${IMAGE_VERSION} \
      org.opencontainers.image.revision=${IMAGE_REVISION} \
      org.opencontainers.image.vendor=${IMAGE_VENDOR} \
      org.opencontainers.image.licenses="LGPL-3.0" \
      org.opencontainers.image.title=${IMAGE_TITLE} \
      org.opencontainers.image.description=${IMAGE_DESCRIPTION}

## Note to editors: The following label assignments are to ensure backward
## compatibility with Label Schema standard
LABEL org.label-schema.build-date=${IMAGE_CREATED} \
      org.label-schema.vcs-url=${IMAGE_SOURCE} \
      org.label-schema.version=${IMAGE_VERSION} \
      org.label-schema.vendor=${IMAGE_VENDOR} \
      org.label-schema.title=${IMAGE_TITLE} \
      org.label-schema.description=${IMAGE_DESCRIPTION}