-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile.local
More file actions
56 lines (42 loc) · 1.98 KB
/
Copy pathDockerfile.local
File metadata and controls
56 lines (42 loc) · 1.98 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM ubuntu:xenial
# not using ubuntu:bionic because phantomjs 1.9.8 does not work there
# (it contains a newer version of OpenSSL which can not be used with phantomjs)
EXPOSE 5488
RUN adduser --disabled-password --gecos "" jsreport && \
apt-get update && \
apt-get install -y --no-install-recommends libgconf-2-4 gnupg git curl wget ca-certificates bzip2 && \
apt-get install -y --no-install-recommends docker.io && \
# cleanup
rm -rf /var/lib/apt/lists/* /var/cache/apt/* && \
rm -rf /src/*.deb
RUN mkdir -p /app
RUN rm -rf /tmp/*
RUN mkdir -p /tmp/yarn-cache
ENV NVM_DIR /root/.nvm
ENV NODE_VERSION 16.18.1
# node
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash && \
/bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION"
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
WORKDIR /app
# we are copying from another image,
# this needs that we build the jsreport/worker, playground_worker previously
# with this tag from the jsreport and playground-worker workspaces
# docker build . -f packages/worker/Dockerfile.local -t jsreport/worker:local
# docker build . -f Dockerfile.local -t playground_worker
COPY --from=playground_worker /app/packages /app/packages
COPY package.json /app/package.json
COPY . /app
RUN npm i -g rimraf yarn json-merger
# ensure clean state, don't copy packages node_modules, so yarn can install from clean state
RUN rimraf packages/**/node_modules
# this fix the infamous yarn error "expected workspace package to exist for ..."
# https://github.com/yarnpkg/yarn/issues/7807#issuecomment-588632848
RUN yarn policies set-version 1.18.0
RUN json-merger -p package.json ./build/workspaces-changes.json -o package.json
RUN yarn install --cache-folder /tmp/yarn-cache
RUN yarn build
RUN yarn cache clean --all && rm -rf /tmp/*
CMD ["node", "server.js"]
# CMD ["node", "--inspect-brk=0.0.0.0:9229", "server.js"]