Skip to content

Commit

Permalink
Adding 3-stage docker build to generate the build and demopage container
Browse files Browse the repository at this point in the history
  • Loading branch information
bylexus committed May 22, 2021
1 parent 1ca5054 commit 8f80f44
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 182 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules/
/demopage/node_modules/
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -------- Stage 1 - Develop Container
FROM node:12 AS develop
VOLUME ["/usr/src/app"]
RUN apt-get update && \
apt-get install -y \
chromium

# -------- Stage 2 - Build Container
FROM develop AS builder
COPY ./ /build/
WORKDIR /build
RUN npm install
RUN npm run build
RUN npm test

WORKDIR /build/demopage
RUN npm install
RUN npm run build


# -------- Stage 3 - Demopage serve container
FROM httpd:2.4
COPY --from=builder /build/demopage/dist/ /usr/local/apache2/htdocs/
173 changes: 0 additions & 173 deletions README.html

This file was deleted.

2 changes: 1 addition & 1 deletion demopage/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<p>
<a href="https://github.com/bylexus/fparse">@see the github page</a> for a more detailed usage
documentation.<br />
The source code of this page can be found <a href="">here</a>.
The source code of this page can be found <a href="https://github.com/bylexus/fparse/blob/develop/demopage/src/App.vue">here</a>.
</p>

<p>
Expand Down
7 changes: 0 additions & 7 deletions docker/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "dist/fparser.js",
"module": "src/fparser.js",
"scripts": {
"docker-image": "docker build --pull -t fparse docker/",
"docker-image": "docker build --pull --target develop -t fparse .",
"docker-shell": "docker run --rm -ti -v \"$PWD\":/usr/src/app -w /usr/src/app fparse bash",
"docker-demopage": "docker run --rm -ti -v \"$PWD\":/usr/src/app -w /usr/src/app/demopage -p 3000:8080 fparse npm run serve",
"docker-test": "docker run --rm -ti -v \"$PWD\":/usr/src/app -w /usr/src/app fparse npm run test",
Expand Down

0 comments on commit 8f80f44

Please sign in to comment.