This repository has been archived by the owner on Aug 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile.travis
39 lines (34 loc) · 1.62 KB
/
Dockerfile.travis
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
33
34
35
36
37
38
39
# This Dockerfile for builds an image on travis that has the checked out source code
# copied into the Docker image. The resulting image can be used as a runtime for
# executing tests.
FROM dsva/healthcare-application:build-cached
# HACK HACK HACK
# Workaround for https://github.com/npm/npm/issues/9863. In Docker, the underlying
# filesystem is aufs which causes problems for atomic renames across filesystem
# layers. This breaks npm because npm depends on the renaming to synchronize
# its internal logic. The npm devs are NOT prioritizing fixing this saying
# it's too Docker specific (...guess everyone is on updated NFS? this used break
# NFSv3 BADLY.). The community has come up with a hack where the filesyste layer
# notices the error and changes from a move to a copy. The following line
# directly patches the npm install replacing fs.move with a version that resorts
# to a copy on a failure. It relies on the fact that a docker build has no
# concurrency.
#
# Is this hack ugly? yes. Is the problem its fixing uglier? Yes. I hate computers.
#
# TODO(awong): Move this into the main build image so it's default for all our
# docker images.
RUN cd $(npm root -g)/npm \
&& npm install fs-extra \
&& sed -i -e s/graceful-fs/fs-extra/ -e s/fs.rename/fs.move/ ./lib/utils/rename.js
WORKDIR /src/healthcare-application
# Ensure any deltas in package.json are reflected.
COPY package.json package.json
COPY npm-shrinkwrap.json npm-shrinkwrap.json
COPY webpack.config.js webpack.config.js
RUN apk update && apk add --no-cache git
ENV NODE_ENV development
RUN npm install
RUN npm run webpack-prod
# Copy all the source into the build image.
ADD . .