renovate/tools/docker/Dockerfile
renovate[bot] 1163c550fe
feat(deps): update ghcr.io/renovatebot/base-image docker tag to v1.23.0 (#27177)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-09 14:50:18 +00:00

84 lines
2.4 KiB
Docker

ARG BASE_IMAGE_TYPE=slim
# --------------------------------------
# slim image
# --------------------------------------
FROM ghcr.io/renovatebot/base-image:1.23.0@sha256:b010a41950e0abcee34a19074de086784d32be7b0a00acc2e46895333532cb2e AS slim-base
# --------------------------------------
# full image
# --------------------------------------
FROM ghcr.io/renovatebot/base-image:1.23.0-full@sha256:b45482d8881f3a0b4d772e2b7e21bac2dbc078fd9eb0c448aec7b92ea8294afd AS full-base
# --------------------------------------
# build image
# --------------------------------------
FROM slim-base as build
WORKDIR /usr/local/renovate
ENV CI=1 npm_config_modules_cache_max_age=0
COPY pnpm-lock.yaml ./
# only fetch deps from lockfile https://pnpm.io/cli/fetch
RUN pnpm fetch --prod
COPY . ./
# install
ENV RE2_DOWNLOAD_MIRROR=https://github.com/containerbase/node-re2-prebuild/releases/download RE2_DOWNLOAD_SKIP_PATH=1
RUN set -ex; \
pnpm install --prod --offline --ignore-scripts; \
npm explore re2 -- npm run install; \
true
# test
COPY tools/docker/bin/ /usr/local/bin/
RUN set -ex; \
renovate --version; \
renovate-config-validator; \
node -e "new require('re2')('.*').exec('test')"; \
true
# --------------------------------------
# final image
# --------------------------------------
FROM ${BASE_IMAGE_TYPE}-base
LABEL name="renovate"
LABEL org.opencontainers.image.source="https://github.com/renovatebot/renovate" \
org.opencontainers.image.url="https://renovatebot.com" \
org.opencontainers.image.licenses="AGPL-3.0-only"
WORKDIR /usr/src/app
ENV RENOVATE_X_IGNORE_NODE_WARN=true
COPY tools/docker/bin/ /usr/local/bin/
CMD ["renovate"]
ARG RENOVATE_VERSION
COPY --from=build --chown=root:root /usr/local/renovate/ /usr/local/renovate/
# Compabillity, so `config.js` can access renovate and deps
RUN set -ex; \
mkdir /opt/containerbase/tools/renovate; \
echo "${RENOVATE_VERSION}" > /opt/containerbase/versions/renovate; \
ln -sf /usr/local/renovate /opt/containerbase/tools/renovate/${RENOVATE_VERSION}; \
ln -sf /usr/local/renovate/node_modules ./node_modules; \
true
RUN set -ex; \
renovate --version; \
renovate-config-validator; \
node -e "new require('re2')('.*').exec('test')"; \
true
LABEL \
org.opencontainers.image.version="${RENOVATE_VERSION}" \
org.label-schema.version="${RENOVATE_VERSION}"
# Numeric user ID for the ubuntu user. Used to indicate a non-root user to OpenShift
USER 1000