From 00ddc2f17411c8ae0211e9c6415fb88325651b63 Mon Sep 17 00:00:00 2001 From: Abhinav Dhasmana Date: Fri, 23 Aug 2019 10:17:50 +0530 Subject: [PATCH] Added docker build step --- .dockerignore | 1 + .github/main.workflow | 23 ++++++++++++++++------- Dockerfile | 12 ++++++++++++ 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.github/main.workflow b/.github/main.workflow index f2494dc..c156507 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -2,24 +2,33 @@ workflow "npm build, lint, test and publish" { on = "push" resolves = [ - "lint", - "test" + "docker build" ] } -action "build" { +action "npm install" { uses = "actions/npm@master" args = "install" } -action "lint" { - needs = "build" +action "npm lint" { + needs = "npm install" uses = "actions/npm@master" args = "run lint" } -action "test" { - needs = "build" +action "npm test" { + needs = "npm install" uses = "actions/npm@master" args = "run test" } + +action "docker build" { + uses = "actions/docker/cli@master" + args = "build -t abhinavdhasmana/github-action-example-node ." + + needs = [ + "npm lint", + "npm test" + ] +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a1f243a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:10.16.0-alpine + +WORKDIR /source/github-action-example-node + +COPY package.json /source/github-action-example-node + +RUN cd /source/github-action-example-node && npm i --only=production + +COPY . . + +EXPOSE 3000 +CMD ["sh", "-c", "node server.js"] \ No newline at end of file