Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile to add non root user #423

Open
wants to merge 2 commits into
base: neo4j
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 (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