renovate/Dockerfile.slim

79 lines
1.6 KiB
Text

# Base image
#============
FROM renovate/yarn:1.19.2@sha256:99b0243ffd7e1c017f61e89bf9e59d0582353007d8350c83b9b153e595be80b8 AS base
LABEL maintainer="Rhys Arkins <rhys@arkins.net>"
LABEL name="renovate"
LABEL org.opencontainers.image.source="https://github.com/renovatebot/renovate"
WORKDIR /usr/src/app/
# required for install
USER root
RUN chown -R ubuntu:ubuntu /usr/src/app/
# and back to normal
USER ubuntu
# Build image
#============
FROM base as tsbuild
USER root
# Python 2 and make are required to build node-re2
RUN apt-get update && apt-get install -y python-minimal build-essential
USER ubuntu
COPY package.json .
COPY yarn.lock .
RUN yarn install --frozen-lockfile
COPY lib lib
COPY tsconfig.json tsconfig.json
COPY tsconfig.app.json tsconfig.app.json
RUN yarn build:docker
# Prune node_modules to production-only so they can be copied into the final image
RUN yarn install --production --frozen-lockfile
# Final image
#============
FROM base as final
# required for install
USER root
# Docker client and group
RUN groupadd -g 999 docker
RUN usermod -aG docker ubuntu
ENV DOCKER_VERSION=19.03.1
RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz \
&& tar xzvf docker-${DOCKER_VERSION}.tgz --strip 1 \
-C /usr/local/bin docker/docker \
&& rm docker-${DOCKER_VERSION}.tgz
# and back to normal
USER ubuntu
COPY package.json .
COPY --from=tsbuild /usr/src/app/dist dist
COPY --from=tsbuild /usr/src/app/node_modules node_modules
COPY bin bin
COPY data data
ENV RENOVATE_BINARY_SOURCE=docker
ENTRYPOINT ["node", "/usr/src/app/dist/renovate.js"]
CMD []