From 66ae17527faa6178306977e6b40067a9be2d21e3 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Mon, 29 Jun 2020 19:51:47 +0000 Subject: [PATCH] Fix and improve Docker build - No need for python2 - Using git to clone specific version - Installing only production Node modules - Remove trailing debug cat command --- Dockerfile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 92d6bcc..0cc12f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,14 +18,12 @@ RUN go build -ldflags="-s -w" -o app main.go FROM --platform=amd64 alpine:${ALPINE_VERSION} AS stackedit ARG STACKEDIT_VERSION WORKDIR /stackedit -RUN apk add -q --progress --update --no-cache git npm python2 -RUN wget -q https://github.com/benweet/stackedit/archive/${STACKEDIT_VERSION}.tar.gz -O stackedit.tar.gz && \ - tar -xzf stackedit.tar.gz --strip-components=1 && \ - rm stackedit.tar.gz -RUN npm install +RUN apk add -q --progress --update --no-cache git npm +RUN git clone --branch ${STACKEDIT_VERSION} --single-branch --depth 1 https://github.com/benweet/stackedit.git . &> /dev/null +RUN npm install --only=prod RUN npm audit fix ENV NODE_ENV=production -RUN sed -i "s/assetsPublicPath: '\/',/assetsPublicPath: '.\/',/g" config/index.js && cat config/index.js +RUN sed -i "s/assetsPublicPath: '\/',/assetsPublicPath: '.\/',/g" config/index.js RUN npm run build FROM scratch AS final