aurelia / docker

MIT License
3 stars 1 forks source link

WIP: Add Docker Images, with dependencies pre installed by default #9

Open shahabganji opened 5 years ago

shahabganji commented 5 years ago

This PR is made to support #8.

From an automation point of view, it would be more convenient to see an Aurelia application as a separate service which requires to run its own tests( e.g. unit/integration/e2e test ), and when all of them passed, get delivered through the CI/CD pipeline, OFC, all should be done by CI/CD pipeline automatically. That being said, I thought that having official docker images, since it is where one will check in the first place, in which almost all required dependencies have been pre-installed for the developers to use, would be a great idea 🙈 just like cypress that has one.


It might be more maintainable and have less burden to have docker images per aurelia-cli versions and with dependencies of aurelia-cli and latest node version. Aurelia applications out there are applications with/without e2e tests, thus, three types of aurelia docker images created:

and their tags will be the current/latest version of aurelia-cli, currently 1.0.2 and latest. I am not sure yet whether the last two or even all of them can be combined into saying aurelia/e2e image. If so, we will face less confusing aurelia docker images which are also self-explanatory.


If everyone is agreed on having such docker images, needless to say, that this repository should be in sync with aurelia-cli repository, and if we are going to accept this PR, then the synchronization is of utmost importance.


The usage of these files would be another Dockerfile for the application which can be used by docker-compose or CI/CD pipeline.

FROM aurelia/base:1.0.2 as build

WORKDIR /app

# install dependencies
COPY ./*.json  ./
RUN npm install 

# copy application
COPY . .

# RUN UNIT TESTS
RUN au test

# publish stage 
FROM build as publish
RUN au build

# runtime
FROM nginx:alpine as run-time
COPY nginx.conf /etc/nginx/nginx.conf
WORKDIR /usr/share/nginx/html
COPY --from=publish /app/dist/ .
EXPOSE 80

cc: @EisenbergEffect, @fkleuver, @3cp

3cp commented 5 years ago

I know very little about docker. If aurelia/cli#1139 depends on this one, let me know when it's ready for that cli PR to be merged.