From c39fdf0dd827be834b17e39947401ad50f205b5f Mon Sep 17 00:00:00 2001 From: NanuIjaz <122975171+NanuIjaz@users.noreply.github.com> Date: Wed, 17 May 2023 22:05:22 +0530 Subject: [PATCH 1/2] Update Dockerfile to add non root user --- Dockerfile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 77dcaaa4..82821cce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,9 @@ FROM node:14.17.6-alpine3.12 -WORKDIR /usr/src/app -RUN apk add git openssh python3 apk-cron make alpine-sdk -COPY . . -RUN npm install -RUN cd script/coin-price-data-fetcher && npm install -RUN touch /var/log/cron.log -RUN echo "*/5 * * * * cd /usr/src/app/script/coin-price-data-fetcher && npm run start-fetcher" > /etc/crontabs/root -RUN echo "* * * * * cd /usr/src/app/ && node ./dist/coin-price/poller.js" >> /etc/crontabs/root +RUN addgroup -g 1001 -S 1001 && adduser -u 1001 -S 1001 -G 1001 +RUN mkdir /home/cardano && mkdir /home/cardano/app +RUN apk add git openssh python3 apk-cron make alpine-sdk busybox-suid +USER 1001:1001 +RUN (cardano -l 2>/dev/null ;echo "*/5 * * * * cd /home/cardano/app/script/coin-price-data-fetcher && npm run start-fetcher")|crontab - +RUN (crontab -l 2>/dev/null;echo "* * * * * cd /home/cardano/app/ && node ./dist/coin-price/poller.js") |crontab - EXPOSE 8080 CMD crond -l 2 -f > /dev/stdout 2> /dev/stderr & node ./dist/index.js From 45ec31de7572cf4aced6ad3d22d021f8855e28a5 Mon Sep 17 00:00:00 2001 From: NanuIjaz <122975171+NanuIjaz@users.noreply.github.com> Date: Tue, 23 May 2023 17:09:01 +0530 Subject: [PATCH 2/2] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 82821cce..a1068f14 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ RUN addgroup -g 1001 -S 1001 && adduser -u 1001 -S 1001 -G 1001 RUN mkdir /home/cardano && mkdir /home/cardano/app RUN apk add git openssh python3 apk-cron make alpine-sdk busybox-suid USER 1001:1001 -RUN (cardano -l 2>/dev/null ;echo "*/5 * * * * cd /home/cardano/app/script/coin-price-data-fetcher && npm run start-fetcher")|crontab - +RUN (crontab -l 2>/dev/null ;echo "*/5 * * * * cd /home/cardano/app/script/coin-price-data-fetcher && npm run start-fetcher")|crontab - RUN (crontab -l 2>/dev/null;echo "* * * * * cd /home/cardano/app/ && node ./dist/coin-price/poller.js") |crontab - EXPOSE 8080 CMD crond -l 2 -f > /dev/stdout 2> /dev/stderr & node ./dist/index.js