-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
30 lines (22 loc) · 962 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
# specify base image
FROM registry.access.redhat.com/ubi8/nodejs-10
ENV TZ="Europe/Helsinki"
WORKDIR /opt/app-root/src
# Install serve to run the app - put this first as this can be cached very well.
RUN npm install -g serve@10.1.2
# Copy package files separately to have them in their own cacheable layer
# and to invalidate the "RUN npm install" cache layer if the files have changed.
#
# Run "npm install" before copying src over so that if the packages remain the
# same, we can re-use the layer cache from our previous build --> no need to
# install a gigantic amount of dependencies.
COPY package*.json .
# Run "ci" instead of "install" to make sure we get exact deps we think we're
# getting. Downside is that dev deps are downloaded as well.
# As "ci" uses the $HOME/.npm package cache, we can tell Travis to cache that.
RUN npm ci
COPY . .
RUN npm run build
EXPOSE 3000
# Set entrypoint to serve the app we just built
CMD serve -s build -p 3000