Skip to content

Commit 00ddc2f

Browse files
author
Abhinav Dhasmana
committed
Added docker build step
1 parent 053f6d8 commit 00ddc2f

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.github/main.workflow

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,33 @@ workflow "npm build, lint, test and publish" {
22
on = "push"
33

44
resolves = [
5-
"lint",
6-
"test"
5+
"docker build"
76
]
87
}
98

10-
action "build" {
9+
action "npm install" {
1110
uses = "actions/npm@master"
1211
args = "install"
1312
}
1413

15-
action "lint" {
16-
needs = "build"
14+
action "npm lint" {
15+
needs = "npm install"
1716
uses = "actions/npm@master"
1817
args = "run lint"
1918
}
2019

21-
action "test" {
22-
needs = "build"
20+
action "npm test" {
21+
needs = "npm install"
2322
uses = "actions/npm@master"
2423
args = "run test"
2524
}
25+
26+
action "docker build" {
27+
uses = "actions/docker/cli@master"
28+
args = "build -t abhinavdhasmana/github-action-example-node ."
29+
30+
needs = [
31+
"npm lint",
32+
"npm test"
33+
]
34+
}

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:10.16.0-alpine
2+
3+
WORKDIR /source/github-action-example-node
4+
5+
COPY package.json /source/github-action-example-node
6+
7+
RUN cd /source/github-action-example-node && npm i --only=production
8+
9+
COPY . .
10+
11+
EXPOSE 3000
12+
CMD ["sh", "-c", "node server.js"]

0 commit comments

Comments
 (0)