forked from renovatebot/renovate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
81 lines (60 loc) · 2.33 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
# renovate: datasource=npm depName=renovate versioning=npm
ARG RENOVATE_VERSION=35.66.3
# Base image
#============
FROM ghcr.io/containerbase/base:7.6.0@sha256:aeb4e8e9246c66d31e471b4233790337e485b88f61915bb1d24a89597eb3d27d AS base
LABEL name="renovate"
LABEL org.opencontainers.image.source="https://github.com/digitecgalaxus/renovate" \
org.opencontainers.image.url="https://renovatebot.com" \
org.opencontainers.image.licenses="AGPL-3.0-only"
# git setup
RUN git config --global user.email '[email protected]'
RUN git config --global user.name 'DG Renovate Bot'
# renovate: datasource=node
RUN install-tool node v18.16.0
# renovate: datasource=npm versioning=npm
RUN install-tool yarn 1.22.19
WORKDIR /usr/src/app
# Build image
#============
FROM base as tsbuild
COPY . .
RUN set -ex; \
yarn install; \
yarn build; \
chmod +x dist/*.js;
# hardcode node version to renovate
RUN set -ex; \
NODE_VERSION=$(node -v | cut -c2-); \
sed -i "1 s:.*:#\!\/opt\/buildpack\/tools\/node\/${NODE_VERSION}\/bin\/node:" "dist/renovate.js"; \
sed -i "1 s:.*:#\!\/opt\/buildpack\/tools\/node\/${NODE_VERSION}\/bin\/node:" "dist/config-validator.js";
ARG RENOVATE_VERSION
RUN set -ex; \
yarn version --new-version ${RENOVATE_VERSION}; \
yarn add -E renovate@${RENOVATE_VERSION} --production; \
node -e "new require('re2')('.*').exec('test')";
# Final image
#============
FROM base as final
# renovate: datasource=docker lookupName=mcr.microsoft.com/dotnet/sdk
RUN install-tool dotnet 7.0.302
# renovate: datasource=github-releases lookupName=helm/helm
RUN install-tool helm v3.12.0
# renovate: datasource=docker versioning=docker
RUN install-tool golang 1.20.4
COPY --from=tsbuild /usr/src/app/package.json package.json
COPY --from=tsbuild /usr/src/app/dist dist
COPY --from=tsbuild /usr/src/app/node_modules node_modules
# exec helper
COPY tools/ /usr/local/bin/
RUN ln -sf /usr/src/app/dist/renovate.js /usr/local/bin/renovate;
RUN ln -sf /usr/src/app/dist/config-validator.js /usr/local/bin/renovate-config-validator;
CMD ["renovate"]
RUN set -ex; \
renovate --version; \
renovate-config-validator; \
node -e "new require('re2')('.*').exec('test')";
ARG RENOVATE_VERSION
LABEL org.opencontainers.image.version="${RENOVATE_VERSION}"
# Numeric user ID for the ubuntu user. Used to indicate a non-root user to OpenShift
USER 1000