diff --git a/Dockerfile b/Dockerfile index 74c2ed9ab2899c7c5d3cffeb90d9ffe3143efe37..e86b37683bb097cc0d564232c03c90a7338d82e6 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 ac12169bdffb2b3424daa989d4ce34d264fa29b2..9dee8392a6959c30d310a06d8708a4b12318dc86 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