Last active
February 16, 2021 03:25
-
-
Save mosesliao/8f9da98a3bca2ced4bcff4dddf6f03b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:8.12-slim as BUILD_IMAGE | |
# install the needed libraries | |
RUN apt-get update \ | |
&& apt-get install -y \ | |
git | |
# install node-prune (https://github.com/tj/node-prune) | |
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin | |
WORKDIR /home/node/app | |
COPY . /home/node/app | |
RUN mkdir /root/.ssh/ | |
COPY id_rsa /root/.ssh/id_rsa | |
RUN chmod 600 /root/.ssh/id_rsa | |
RUN npm install | |
RUN npm prune --production | |
RUN /usr/local/bin/node-prune | |
# use node has user | |
FROM node:8.12-slim | |
LABEL version="0.5.0" | |
COPY --from=BUILD_IMAGE /home/node/app /home/node/app | |
USER "node" | |
WORKDIR /home/node/app | |
# use node has user | |
EXPOSE 3030 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment