From 9d773fcd5a99da365c24f5c5ed1ad517ccdcc443 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 17 Jun 2023 14:53:59 +0200 Subject: [PATCH] install rust build tools in base container, remove it in production container --- backend/Dockerfile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 8f7313529..79a05fde6 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,10 +1,7 @@ ################################################################################## # BASE ########################################################################### ################################################################################## -# base on custom docker container which is essential node:18.7.0-alpine3.16 -# but with installed build-tools for rust native npm modules -# and with compiled @iota/client -FROM gradido/iota_alpine:2.2.4 as base +FROM node:18.7.0-alpine3.16 as base # ENVs (available in production aswell, can be overwritten by commandline or env file) ## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame @@ -36,6 +33,8 @@ LABEL maintainer="support@gradido.net" # Install Additional Software ## install: git #RUN apk --no-cache add git +# Install Build Tool for Rust for @iota/client +RUN apk add --no-cache rust cargo python3 make g++ # Settings ## Expose Container Port @@ -70,9 +69,6 @@ COPY ./backend/ ./ # Copy everything from database COPY ./database/ ../database/ -# Copy prebuild @iota/client -RUN cp -r /prebuild_node_modules ${WORKDIR}/node_modules - # yarn install backend RUN yarn install --production=false --frozen-lockfile --non-interactive @@ -98,6 +94,9 @@ CMD /bin/sh -c "yarn run start" ################################################################################## FROM base as production +# Remove Build Tool for Rust else they would bloat the image unneccessary +RUN apk del rust cargo python3 make g++ + # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/build ./build COPY --from=build ${DOCKER_WORKDIR}/../database/build ../database/build