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

V2 stable #7

Open
wants to merge 19 commits into
base: v2
Choose a base branch
from
Open

V2 stable #7

wants to merge 19 commits into from

Conversation

xoxefdp
Copy link
Owner

@xoxefdp xoxefdp commented Sep 6, 2020

xgin and others added 19 commits May 1, 2017 01:13
The existing Dockerfile was a Ubuntu image which installed Node and NPM via
apt-get. This change set updates the Dockerfile to use the offical Node
image which has the chosin version of Node and NPM pre-installed.

It also switches to an Alpine image to lower the file size.
This change set updates the docker-compose file in the develop folder to use
the v3 syntax. This allows us to add a user layer network so that the two
containers can communicate without having to go up the network stack. This
allows us to not have to expose the registery's port (5000) to the host.

This reduces the chance of a port conflict
I just perfer to see the dependancies at the bottom as they can tend to grow
and it makes it easier to view the more important stuff like meta info about
the package and the scripts in a terminal editor if they are at the top
This change set removes 🔥 Bower as the dependancy package manager and
switches over to NPM. Bower requiers all packages to be in git and pulls
them out of a public git repo. NPM on the other hand is a registry of
packages and it has become the go to for JS package dependancy for both
Node and Browser applications. The Bower website even suggests moving
off Bower in favor of NPM/Yarn.
Docker files can now be setup to use multiple images to generate a build
pipe line. This allows you to use different images (i.e. official images) vs.
a single image with all tools installed.

With this change we can remove NPM and Node from the run time image which just
needs Apache. We can also seperate the hosting commands from the compilation
commands.

The current Dockerfile installed apache, node, and npm as well as packages
required to install the NPM packages used to _build_ the angular app. Once
built all the files are served staticlly via apache. Node and NPM are _not_
needed to host the application. This results in dependencies and commands
being mixed up.

This change set splits the Dockerfile into two stages: Build and Host

The Build stage uses an offical Node image and installs the OS packages
needed to run the Grunt tasks. It then copies in the source files and
runs Grunt build. The artifacts of this image are located in the dist directory.

The Host stage uses a debian:jessie image and installs apache (maybe later
we can move to an offical Apache image), it then copies the artifacts from
the Build stage into its /var/www/html folder, then configers and starts
Apache.

Now the steps and dependencies are nicely seperated
With the change to move off bower I had to update angular-smart-table  because
NPM did not have the very old version we were using. The oldest 1.x version it
had was 1.4.12.

In angular-smart-table  1.4.2 however they refactored their smart-table.module.js
file to no longer pass in the angular global but instead refernce the ng
variable directly. This caused an issue with the Karma config as ng  is unknown.

Looking at lorenzofox3/Smart-Table@13da8c9#diff-40dfb1c53004f1488cbe6eb300b286dd
I see what they did for their Karma test config so this change set is just
copying that to ensure that the angular-smart-table  module is imported
propertly in the tests. This does not seem to be an issue in prod.
…i-stage

Refactor Dockerfile to use multi-stage feature
Remove apache2.pid which can hang around after dirty exit
Update development docker-compose to v3 syntax
Update development Dockerfile to official Node 8 image
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.

3 participants