-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
31 lines (24 loc) · 998 Bytes
/
Dockerfile
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
# Use a Node.js image and assign it as our build
FROM mhart/alpine-node:10 as build
# Set the working directory, copy dependency management files to the working directory,
# and install the dependencies
WORKDIR /usr/src
COPY package.json yarn.lock ./
RUN yarn install
# Copy all files to the working directly, build the application
# and purge the development dependencies
COPY . .
RUN yarn build
# # Create a new image using a minimal Node.js image
# # with no extra tools packaged in, such as Yarn or npm for the smallest final size
# FROM mhart/alpine-node:base-10
# Set the working directory for the new image and
# set the `NODE_ENV` environment variable value to `production`
# along with setting the path for node_modules to be accessible
# WORKDIR /usr/src
ENV NODE_ENV="production"
ENV PATH="./node_modules/.bin:$PATH"
# Copy files from the base image over to our new image's working directory
COPY --from=build /usr/src .
# Start the server for Next.js using Node.js
CMD yarn start