Last active
October 16, 2018 22:36
-
-
Save marweck/f424f34fc0b58a6f8c14353d18249ea6 to your computer and use it in GitHub Desktop.
Docker image for building and running Node app on server
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
| # --- base --- | |
| FROM node:8-alpine AS base | |
| RUN mkdir -p /var/www && mkdir -p /var/log/app | |
| ADD package.json /var/www | |
| COPY . /tmp/ | |
| RUN cd /tmp && \ | |
| apk add --no-cache make gcc g++ python && \ | |
| npm install -g typescript && \ | |
| npm install --production --silent && \ | |
| npm run build && \ | |
| apk del make gcc g++ python | |
| # --- release --- | |
| FROM node:8-alpine AS release | |
| WORKDIR /app | |
| COPY --from=base /tmp/node_modules ./node_modules | |
| COPY --from=base /tmp/dist . | |
| VOLUME /var/log/app | |
| EXPOSE 3000 | |
| CMD ["node", "main.js"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment