Skip to content
Snippets Groups Projects
Dockerfile 2.39 KiB
Newer Older
FROM eclipse-temurin:22-jdk-noble AS build
RUN set -eux; \
    mkdir -p build/dependency; \
    jar -xf ../libs/*-SNAPSHOT.jar
FROM eclipse-temurin:22-jdk-noble
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

ARG UID=1001
ARG GID=1002

RUN set -eux; \
    groupadd --system --gid "$GID" app; \
    useradd --system --uid "$UID" --gid "$GID" appuser --no-create-home --home /nonexistent

# Install dependencies needed to run OCCMD tool
# file is needed by https://github.com/fkie-cad/fact_helper_file
RUN set -eux; \
    apt-get update; \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
Lucas Briese's avatar
Lucas Briese committed
    file \
    curl; \
    rm -rf /var/lib/apt/lists/*;
WORKDIR /usr/local/bin
RUN set -eux; \
    wget https://github.com/XAMPPRocky/tokei/releases/download/v13.0.0-alpha.0/tokei-x86_64-unknown-linux-musl.tar.gz -O - | tar zxf -;\
    which tokei
RUN set -eux; \
    git clone --depth 1 --single-branch --branch main https://gitlab.opencode.de/opencode-analyzer/occmd-public.git /occmd; \
    git submodule update --init --recursive; \
    python3 -m venv venv; \
    . venv/bin/activate; \
    python3 -m pip install wheel; \
    python3 -m pip install -r requirements.txt; \
    mkdir -p /occmd/resources/checks/checked_in_binaries/blacklist; \
    git clone --depth 1 https://gitlab.opencode.de/opencode-analyzer/occmd-checked_in_binaries-blacklist /app/resources/checks/checked_in_binaries/blacklist;
Lucas Briese's avatar
Lucas Briese committed
COPY tools/occmd/occmdcfg.ini .
COPY kubernetes/scripts/startupProbe.sh /kubernetes/scripts/
Jan-Niclas Strüwer's avatar
Jan-Niclas Strüwer committed
VOLUME /tmp
ARG DEPENDENCY=/app/build/dependency
Jan-Niclas Strüwer's avatar
Jan-Niclas Strüwer committed
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
# User creation so we don't need to run the image with the root user
WORKDIR /app
RUN set -eux; \
    mkdir -p /app/git; \
    chown -R appuser:app /occmd /app; \
    chmod u+x /app/scripts/occmd.sh

# Workaround until OCCMD tool is included into CI/CD
ENTRYPOINT ["java","-cp","/app:/app/lib/*", "de.fraunhofer.iem.app.DataProviderApplicationKt"]

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.