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