Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile: Multi-stage build with Node.js and Ant with Runtime in Apache/php #110

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

marcellodesales
Copy link

@marcellodesales marcellodesales commented Apr 27, 2018

Using the snippets from the following work:

The build will make all the necessary calls, while the runtime runs
Apache with PHP as it is required.

img

Build

$ docker build -t marcellodesales/harviewer .
Sending build context to Docker daemon   77.2MB
Step 1/10 : FROM node:6-wheezy as builder
 ---> d782cc30cf7b
Step 2/10 : RUN apt-get update -y &&     apt-get install -y ant
 ---> Using cache
 ---> e02e345efa03
Step 3/10 : ADD . /build
 ---> Using cache
 ---> f4c16fa28572
Step 4/10 : WORKDIR /build
 ---> Using cache
 ---> d8eff6fb4a7b
Step 5/10 : RUN npm install &&     ant build
 ---> Using cache
 ---> 5563e3e09bd6
Step 6/10 : FROM php:apache
 ---> ac8c4378955f
Step 7/10 : MAINTAINER [email protected]
 ---> Using cache
 ---> 395c01f9c851
Step 8/10 : LABEL github.com https://github.com/marcellodesales/harviewer
Dockerfile: Multi-stage build with Node.js and Ant with Runtime in Apache/PHP
 ---> Using cache
 ---> 96a8cfd13b3d
Step 9/10 : COPY --from=builder /build/webapp-build /var/www/html
 ---> Using cache
 ---> 3464ac53f1b7
Step 10/10 : EXPOSE 80
 ---> Using cache
 ---> 26195a9456d3
Successfully built 26195a9456d3
Successfully tagged harviewer:latest

Running

$ docker run -ti -p 8080:80 marcellodesales/harviewer
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Fri Apr 27 00:15:26.090641 2018] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.4 configured -- resuming normal operations
[Fri Apr 27 00:15:26.090714 2018] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
172.17.0.1 - - [27/Apr/2018:00:15:33 +0000] "GET / HTTP/1.1" 200 858 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
172.17.0.1 - - [27/Apr/2018:00:15:33 +0000] "GET /scripts/require.js HTTP/1.1" 200 7021 "http://localhost:8080/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
172.17.0.1 - - [27/Apr/2018:00:15:33 +0000] "GET /css/harViewer.css HTTP/1.1" 20

…ache/PHP

Using the snippets from the following work:

* https://github.com/mrorgues/dockerfiles/tree/master/har_viewer_builder
* https://github.com/mrorgues/dockerfiles/tree/master/har_viewer

The build will make all the necessary calls, while the runtime runs
Apache with PHP as it is required.
@marcellodesales marcellodesales changed the title Dockerfile: Multi-stage build with Node.js and Ant with Runtime in Ap… Dockerfile: Multi-stage build with Node.js and Ant with Runtime in Apache/php Apr 27, 2018
@gitgrimbo
Copy link
Collaborator

Hi @marcellodesales, thanks for this. I have a couple of similar Dockerfiles that I used to use to build/test/run HAR Viewer, but I was never confident enough in my Docker skills to push them into the repo.

I also have some outstanding branches that remove the remaining Ant dependencies, so I might revisit those branches and see if I can push them before adding any Dockerfile that builds HAR Viewer using Ant.

Thanks again for this, and if I can't be sure to finish the above in good time then I'll revisit your pull request without my changes.

@marcellodesales
Copy link
Author

@gitgrimbo No problem... I have used the latest/greatest Docker build capabilities to separate the Build Image and the Runtime image... We can still decrease the size of the final image, even though it works with Apache...

I would suggest starting from this point... Then we improve it... Most importantly, anyone would be able to run the Har viewer with no sweat :)

@gitgrimbo
Copy link
Collaborator

@marcellodesales - Is it worth using jessie rather than wheezy?

wheezy no longer present here - https://github.com/nodejs/docker-node/tree/master/6
removed here - nodejs/docker-node@773be66

@marcellodesales
Copy link
Author

@gitgrimbo Yeah we can change it as needed... Let me verify...

@marcellodesales
Copy link
Author

@gitgrimbo I just updated the image and verified it is all good!

@gitgrimbo
Copy link
Collaborator

Thanks @marcellodesales!

Things have moved on a bit since you created this PR.

#111 was merged to remove Ant from the build process, and I am working on this x-remove-php branch to remove PHP (feel free to try the branch [it works], but I might be force-pushing to it, so please don't rely on it yet).

So ultimately, it could be that the 'builder' Dockerfile only needs NodeJS, and the 'runner' Dockerfile only needs plain Apache, rather than a PHP variant.

Do you have any thoughts?

@marcellodesales
Copy link
Author

@gitgrimbo let me know the direction... Once you merge x-remove-php I can create another PR and rebuild the Dockerfile

@gitgrimbo
Copy link
Collaborator

Hi @marcellodesales. The removal of PHP was done in #118, so in theory a Dockerfile to build HAR Viewer would now only need node/npm installed. If you also want to run the tests, then Java would need to be installed for Selenium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants