Skip to content

Commit 1de387d

Browse files
committed
Adding dockerfile
1 parent 83e9554 commit 1de387d

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

‎dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use an official Node runtime as a parent image
2+
FROM node:14
3+
4+
# Set the working directory in the container
5+
WORKDIR /usr/src/app
6+
7+
# Copy the current directory contents into the container at /usr/src/app
8+
COPY . .
9+
10+
# Install any needed packages specified in package.json
11+
RUN npm install
12+
13+
# Install Chrome for Selenium tests
14+
RUN apt-get update && apt-get install -y \
15+
gnupg \
16+
wget \
17+
&& wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
18+
&& apt install ./google-chrome-stable_current_amd64.deb -y
19+
20+
# Make port available to the world outside this container
21+
EXPOSE 8080
22+
23+
# Define environment variable
24+
ENV NODE_ENV production
25+
26+
# Run npm test when the container launches
27+
CMD ["npm", "test"]

‎package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
"main": "index.js",
66
"scripts": {
77
"build": "npm run clean && tsc",
8+
"docker-build": "docker build -t yourdockerusername/mocha-typescript .",
89
"clean": "rimraf ./build ./package.zip",
910
"test": "_mocha ./build/test/restrictedAccessTest.js --timeout=999999 --exit",
10-
"regression": "_mocha ./build/test/regression.js --timeout=999999 --exit"
11-
11+
"regression": "_mocha ./build/test/regression.js --timeout=999999 --exit",
12+
"invalidLoginTest": "_mocha ./build/test/invalidLoginTest.js --timeout=999999 --exit",
13+
"restrictedAccessTest": "_mocha ./build/test/restrictedAccessTest.js --timeout=999999 --exit",
14+
"shoppingExp": "_mocha ./build/test/shoppingExp.js --timeout=999999 --exit",
15+
"validLoginTest": "_mocha ./build/test/validLoginTest.js --timeout=999999 --exit"
1216
},
1317
"keywords": [],
1418
"author": "Apichai Tochonnabod",

0 commit comments

Comments
 (0)