From c6d84cd0e4d9c395c5dfdf372170954265e4d399 Mon Sep 17 00:00:00 2001
From: Quentin Duchemin <quentinduchemin@tuta.io>
Date: Tue, 27 Oct 2020 19:08:27 +0100
Subject: [PATCH] [CodiMD] Use global ARG in Dockerfile

---
 pica-codimd/Dockerfile | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/pica-codimd/Dockerfile b/pica-codimd/Dockerfile
index 66c253ed..805d68a8 100644
--- a/pica-codimd/Dockerfile
+++ b/pica-codimd/Dockerfile
@@ -1,10 +1,10 @@
-FROM node:10.22.1-alpine3.11 as BUILD
-
-ENV VERSION=2.2.0
-ENV PORTCHECKER_VERSION=v1.0.6
+ARG VERSION=2.2.0
+ARG PORTCHECKER_VERSION=v1.0.6
 
+FROM node:10.22.1-alpine3.11 as BUILD
+ARG VERSION
 RUN apk add --no-cache --virtual .gyp libressl-dev git bash python make && \
-wget https://github.com/hackmdio/codimd/archive/$VERSION.tar.gz && \
+wget https://github.com/hackmdio/codimd/archive/${VERSION}.tar.gz && \
 tar xzf $VERSION.tar.gz -C /opt && \
 mv /opt/codimd-$VERSION /opt/codimd
 
@@ -18,14 +18,15 @@ RUN cd /opt/codimd && npm install && \
         config.json.example README.md CONTRIBUTING.md AUTHORS node_modules
 
 FROM node:10.22.1-alpine3.11
-
+ARG PORTCHECKER_VERSION
 RUN addgroup --gid 5010 codimd && \
     adduser -u 5010 -G codimd -D codimd && \
     mkdir /home/$USER_NAME/.npm && \
     echo "prefix=/home/codimd/.npm/" > /home/$USER_NAME/.npmrc && \
     mkdir -p /home/codimd/app && \
     chown -R codimd:codimd /home/codimd && \
-    apk add --no-cache git bash python && \
+    # Git needed so NPM can clone packages and Python for node-gyp
+    apk add --no-cache bash git python && \
     wget https://github.com/hackmdio/portchecker/releases/download/${PORTCHECKER_VERSION}/portchecker-linux-amd64.tar.gz && \
     tar xvf portchecker-linux-amd64.tar.gz -C /usr/local/bin && \
     mv /usr/local/bin/portchecker-linux-amd64 /usr/local/bin/pcheck && \
-- 
GitLab