forked from Yengas/nodejs-docker-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (24 loc) · 976 Bytes
/
Dockerfile
File metadata and controls
32 lines (24 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Dockerfile to build `binary` image which will have everything packages like dependenecies and codes.
# This image can be configured and run with environment variables.
FROM node:9.4.0-alpine as builder
# Add build tools necessary for npm installations.
RUN apk add --no-cache make gcc g++ python
WORKDIR /application
# Add package.json for dependency installation.
ADD ./package.json ./package.json
# Install all dependencies.
RUN npm install --only=production
# Release docker image
# As the last stage.
FROM node:9.4.0-alpine as release
WORKDIR /application
# Add the codes and other stuff to the application folder.
ADD . .
# Remove node_modules older just in case..
RUN rm -rf /application/node_modules
# Copy the dependency installation from the builder image.
COPY --from=builder /application/node_modules /application/node_modules
# Indicate that we use 8080. Maybe configurable.
EXPOSE 8080
# Start the application.
CMD ["node", "/application/bin/index.js"]