Created
December 23, 2023 03:00
-
-
Save itxtoledo/63cb5cbd431070fede2345247cd71254 to your computer and use it in GitHub Desktop.
Dockerfile nodejs yarn
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:18.0.0-alpine | |
ARG SSH_KEY | |
RUN apk add --no-cache dumb-init | |
ENTRYPOINT ["/usr/bin/dumb-init", "--"] | |
WORKDIR /usr/src/app | |
# Install openssh | |
RUN apk add --no-cache openssh | |
# Add github to known hosts | |
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts | |
COPY . . | |
# yarn and yarn build will install, build and remove dev dependencies | |
RUN ssh-agent sh -c 'echo $SSH_KEY | base64 -d | ssh-add - ; yarn && yarn build' | |
ENV NODE_ENV=production | |
CMD yarn start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment