From 5d56ab0fca89f5bb6e19048e0976991c99f876cb Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Fri, 23 Aug 2019 07:35:10 +0200 Subject: [PATCH] build: fix dockerfile re2 (#4349) --- Dockerfile | 8 ++++---- Dockerfile.slim | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 74c2ed9ab2..e86b37683b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ ENV DEBIAN_FRONTEND noninteractive ENV LC_ALL C.UTF-8 ENV LANG C.UTF-8 -RUN apt-get update && apt-get install -y gpg curl wget unzip xz-utils git openssh-client bsdtar && apt-get clean -y +RUN apt-get update && apt-get install -y gpg curl wget unzip xz-utils git openssh-client bsdtar build-essential && apt-get clean -y ## Gradle @@ -137,11 +137,11 @@ USER ubuntu # Cargo ENV RUST_BACKTRACE=1 \ - PATH=/home/ubuntu/.cargo/bin:$PATH + PATH=/home/ubuntu/.cargo/bin:$PATH RUN set -ex ;\ - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y ; \ - rustup toolchain install 1.36.0 + curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y ; \ + rustup toolchain install 1.36.0 # Pipenv diff --git a/Dockerfile.slim b/Dockerfile.slim index ac12169bdf..9dee8392a6 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -20,6 +20,14 @@ USER ubuntu #============ 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 @@ -30,6 +38,9 @@ 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 #============ @@ -55,11 +66,10 @@ RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${ # and back to normal USER ubuntu - COPY package.json . -COPY yarn.lock . -RUN yarn install --production --frozen-lockfile + COPY --from=tsbuild /usr/src/app/dist dist +COPY --from=tsbuild /usr/src/app/node_modules node_modules COPY bin bin COPY data data -- GitLab