This repository was archived by the owner on Oct 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathnode.docker
More file actions
61 lines (46 loc) · 2.21 KB
/
Copy pathnode.docker
File metadata and controls
61 lines (46 loc) · 2.21 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
57
58
59
60
61
# RUN-USING: docker run --rm --name=node codewars/node-runner --help
# EXAMPLE USAGE: docker run --rm codewars/node-runner run -l javascript -c "console.log(1+1)"
# Pull base image.
FROM codewars/base-runner
# Install additional libraries
# NOTE: due to this issue https://github.com/npm/npm/issues/9863 we need to install everything at once, which sucks
# because we lose the ability to quickly add new ones as a new layer
# NOTE: we dont configure these via package.json in order to prevent having to re-install them on each code change
# Install Node manager so that we can have multiple versions of node
RUN npm -g install n
RUN n 0.10.33
RUN n 8.1.3
# 6.x must come last since it's the version for the runner itself
RUN n 6.11.0
# install TypeScript type definitions
RUN npm install -gq typings
# Install Coffeescript
RUN npm -g install coffee-script
# Install TypeScript
RUN npm -g install typescript
# add the package json first to a tmp directory and build, copy over so that we dont rebuild every time
ADD package.json /tmp/package.json
RUN cd /tmp && npm install && npm install --only=dev && npm dedupe
RUN mkdir -p /runner && cp -a /tmp/node_modules /runner
# ADD cli-runner and install node deps
ADD . /runner
# add display as if it is a node module, so that it can easily be included via require("display")
ADD ./frameworks/javascript/display.js /runner/node_modules/display/index.js
ADD ./frameworks/javascript/chai-display.js /runner/node_modules/chai-display/index.js
ADD ./frameworks/javascript/display.js /runner/node_modules/chai-display/display.js
#ADD ./frameworks/javascript/require-url.js /runner/node_modules/require-url/index.js
# add typings into a cleaner path for inclusion
ADD typings/main/ambient /runner/typings
RUN ln -s /home/codewarrior /workspace
WORKDIR /runner
ENV NODE_PATH /usr/lib/node_modules:/runner/node_modules
# Set environment variables
ENV HOME /home/codewarrior
USER codewarrior
ENV USER codewarrior
# Run the test suite to make sure this thing works
RUN mocha -t 10000 test/runners/{javascript,coffeescript}_spec.js
RUN mocha -t 10000 test/runners/typescript_spec.js
#timeout is a fallback in case an error with node
#prevents it from exiting properly
ENTRYPOINT ["timeout", "15", "node"]