Last active
January 22, 2018 03:25
-
-
Save f15gdsy/f2aa15a45a99b124ef5482adc2b510ce to your computer and use it in GitHub Desktop.
Dockerfile nginx-node
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
node_modules |
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
# build-env | |
FROM node:alpine AS build-env | |
LABEL builder=true | |
# If has native dependencies, uncomment the following line | |
# RUN apk add --no-cache make gcc g++ python | |
# Replace NPM registry to Taobao | |
RUN npm set registry https://registry.npm.taobao.org && \ | |
npm set registry https://registry.npm.taobao.org && \ | |
npm set registry https://registry.npm.taobao.org && \ | |
npm set chromedriver_cdnurl http://cdn.npm.taobao.org/dist/chromedriver && \ | |
npm set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents && \ | |
npm set operadriver_cdnurl http://cdn.npm.taobao.org/dist/operadriver && \ | |
npm set phantomjs_cdnurl http://cdn.npm.taobao.org/dist/phantomjs && \ | |
npm set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass && \ | |
# Install Yarn | |
npm install -g -s --no-progress yarn && \ | |
# Work in /app | |
mkdir -p /app | |
WORKDIR /app | |
COPY package.json yarn.lock ./ | |
RUN yarn | |
COPY . ./ | |
RUN npm run build | |
# The real build | |
FROM nginx:alpine | |
LABEL builder=false | |
COPY --from=build-env /app/dist /usr/share/nginx/html/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment