Adds documentation for using node-gyp in alpine release (#907)

This commit is contained in:
Daniel Cohen 2018-12-02 11:05:18 +02:00 committed by Simen Bekkhus
parent 741bef243a
commit 7db40ed097
1 changed files with 28 additions and 0 deletions

View File

@ -10,6 +10,7 @@
- [CMD](#cmd)
- [Docker Run](#docker-run)
- [Security](#security)
- [node-gyp in apline variant](#node-gyp-alpine)
## Environment Variables
@ -153,3 +154,30 @@ $ docker run \
## Security
The Docker team has provided a tool to analyze your running containers for potential security issues. You can download and run this tool from here: https://github.com/docker/docker-bench-security
## node-gyp alpine
Here is an example of how you would install dependencies for packages that require node-gyp support on the alpine variant:
```Dockerfile
FROM node:alpine
RUN apk add --no-cache --virtual .gyp python make g++ \
&& npm install [ your npm dependencies here ] \
&& apk del .gyp
```
And Here's a multistage build example
```Dockerfile
FROM node:alpine as builder
## Install build toolchain, install node deps and compile native add-ons
RUN apk add --no-cache --virtual .gyp python make g++ \
RUN npm install [ your npm dependencies here ]
FROM node:alpine as app
## Copy built node modules and binaries without including the toolchain
COPY --from=builder node_modules .
```