renovate/Dockerfile.slim

87 lines
2.1 KiB
Text

# Base image
#============
FROM renovate/yarn:1.22.0@sha256:a7737a9182c1456ac089022a44bea22eb9d5069b3f8388cda06b473717a8dd41 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 .
COPY tools tools
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
# The git version of ubuntu 18.04 is too old to sort ref tags properly (see #5477), so update it to the latest stable version
RUN echo "deb http://ppa.launchpad.net/git-core/ppa/ubuntu bionic main\ndeb-src http://ppa.launchpad.net/git-core/ppa/ubuntu bionic main" > /etc/apt/sources.list.d/git.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E1DD270288B4E6030699E45FA1715D88E1DF1F24 && \
apt-get update && \
apt-get -y install git && \
rm -rf /var/lib/apt/lists/*
# 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 []