Smaller Docker image by switching the base image to node:10.13.0-alpine and consolidating scripts

This commit is contained in:
Gabe Cook 2018-11-30 05:41:45 +00:00
parent e37dd69827
commit 9cb9ea6ab5
No known key found for this signature in database
GPG key ID: 3197318BDE319B8D

View file

@ -1,21 +1,27 @@
FROM node:10.13.0
RUN apt-get update && apt-get install -y nasm
FROM node:10.13.0-alpine
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# Copy both package.json and package-lock.json
# where available (npm@5+)
COPY package*.json ./
COPY package.json package-lock.json ./
RUN npm install --production
# If you are building your code for production
# RUN npm install --only=production
# Install app dependencies
RUN set -x \
&& apk add --no-cache --virtual .build-dependencies \
autoconf \
automake \
g++ \
gcc \
libtool \
make \
nasm \
&& npm install --production \
&& apk del .build-dependencies
# Bundle app source
COPY . .
EXPOSE 8080
CMD [ "node", "src/www" ]
CMD [ "node", "./src/www" ]