-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Dockerfile
82 lines (61 loc) · 2.27 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
ARG BASE_IMAGE_TYPE=slim
# --------------------------------------
# slim image
# --------------------------------------
FROM ghcr.io/renovatebot/base-image:2.12.10@sha256:b5915dea00d86ad71936620c40e250b5414e6e6cd9c96df0c877971f1b289286 AS slim-base
# --------------------------------------
# full image
# --------------------------------------
FROM ghcr.io/renovatebot/base-image:2.12.10-full@sha256:2c788aedac0430888eb4f3bcbf0e67b4e55254de05ac214096fa0f3604f00621 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 corepack pnpm fetch --prod
COPY . ./
# install
RUN set -ex; \
corepack pnpm install --prod --offline --ignore-scripts; \
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