Skip to content

WIP feat(docker): Docker build and deploy #885

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

Closed
wants to merge 2 commits into from

Conversation

cgmartin
Copy link
Contributor

@cgmartin cgmartin commented May 22, 2016

DO NOT MERGE

This is a work-in-progress implementation of the Docker deploy design.

  • ng docker:init - Initializes settings and files for building and deploying to a Docker environment.
  • ng docker:push - Builds and pushes a Docker image of the built ng app.
  • ng docker:deploy - Deploys ng app containers to a Docker Machine environment.
  • Convert JS to TypeScript
  • Unit Tests

@filipesilva filipesilva added feature Issue that requests a new feature state: WIP labels Jul 27, 2016
@suchja
Copy link

suchja commented Aug 6, 2016

@cgmartin Great work especially on the design proposal. Do you have any plans on implementing this?

I tried having an image with the latest angular-cli version running in it. However it seems a little fragile with respect to permissions. I've seen that you investigated in this area. Did you have success with running angular-cli in a container?

@cgmartin
Copy link
Contributor Author

@suchja There's been a good bit of changes this year with Docker Native for Mac/Win that I hoped would settle, but in all honesty, other priorities got the best of me over the past few months. Its on my list to come back to, but I don't have an ETA. Don't let me hold up other contributions if others are able.

I'm considering reducing the scope for an initial PR from what is listed in the design proposal to only include ng docker:init, skipping implementation of ng docker:push and ng docker:deploy for a first pass. Users (myself included) can get by using the docker CLI tools themselves for building and deploying. The other Angular CLI docker commands could be targeted in a future PR.

When I tested the Dockerfile in the PR at the time with angular-cli, it worked. I assume it should still. Very simple nginx base image - not much to it: configure nginx and copy angular dist into the image. Requires that you build the app artifacts (ng build) into ./dist folder before running docker build.

@cgmartin
Copy link
Contributor Author

cgmartin commented Aug 29, 2016

@suchja

Did you have success with running angular-cli in a container?

Ah, sorry, re-read your note. My original intent here was a deployable production image of the app artifact. I didn't have plans for an angular-cli development environment container. Has traditionally been tricky for Node.js apps with permissions that you mentioned, among other things (file watchers, npm installs). Docker Native might improve things? I personally favor vagrant/VM images for that use-case of shared Node.js development environments for the moment.

@TheDonDope
Copy link

Hi @cgmartin,

if you need help on this, i would like to offer my support!

Greetings

Dope

@suchja
Copy link

suchja commented Sep 28, 2016

@TheDonDope seems like currently @cgmartin has not much time for this. In general I'm willing to spend some time on this, but this is also limited. Additionally it should be clear into which direction the docker support is going.
While I have the need to run angular-cli in a container for development, the general design proposal and initial work here from @cgmartin is heading towards container support for production.
I'm not clear on how much those activities have in common as I'm currently mainly focus on development and don't have much experience with production.

So in case you like to work with me on this just send me a note. I did start with a really basic support. You can have a look here. There is an automated build on docker hub as well. Currently I'm updating to the latest version.

@TheDonDope
Copy link

TheDonDope commented Oct 11, 2016

Hey @suchja,

sorry for my late reply.

I had a look at your basic support, looks like a solid start to me :)

My specific interest is in the deploy-for-production part.

As @cgmartin mentioned in the comments of his design doc, some people might want to do a production build with $ ng build -prod and then host the built files in /dist in a nginx container.

This is a setup i also want to use in a personal project of mine: https://github.com/TheDonDope/crudular

However i am currently struggling with the correct nginx configuration to support PathLocationStrategy of Angular 2.

Do you have any experience with it?

I will push a work-in-progress branch later this week and keep you updated.

Greetings

@TheDonDope
Copy link

@suchja Here is my initial work: TheDonDope/crudular#1

@TheDonDope
Copy link

@suchja I now have implemented a nginx production docker build, you can have a look here: https://github.com/TheDonDope/crudular. I added a description in the README on how the containers are setup and to be used: https://github.com/TheDonDope/crudular#dockerization

@suchja
Copy link

suchja commented Nov 6, 2016

@TheDonDope sorry for not coming back on this! I see your improvements on your local project (although I'm missing a bit of a general description what's the intention and goal of your project). With respect to docker and angular-cli it looks promising, but correct me if I'm wrong there are currently no enhancements done in angular-cli, or?

Probably I'm just not clear on what exactly your goal is. In case you think about adding some of your work to angular-cli it would be good to create a short design proposal stating your use case and solution ideas?

While getting more experience in my projects with angular-cli, I do see the personal need to have docker support for development in angular-cli. My two step approach (having 2 Dockerfiles which need to be copied) is a bit messy ;-). Guess it should be easy to extend angular-cli to generate the "second" Dockerfile as part of "ng new". However, I do not have looked into this by now.

@RicardoVaranda
Copy link
Contributor

RicardoVaranda commented Jan 8, 2017

@cgmartin Would you mind if I start doing some work on this, I have the same use case for our internal projects where we depend heavily in the cli deploying it with nginx on docker.
I see you mentioned you are caught for time so I wouldn't mind helping with this as I see it being very useful.

@hansl
Copy link
Contributor

hansl commented Jan 9, 2017

This is way too stale and we won't support it for 1.0 final. I'm going to close it and we will review when we support different deploy options.

@hansl hansl closed this Jan 9, 2017
@mohuk
Copy link
Contributor

mohuk commented Dec 5, 2017

Any plans for bringing this up? Everyone is using Docker for deployment and is duplicating the efforts. How about we just support ng docker:init just to spawn a file with basic nginx configs for deployment?

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Issue that requests a new feature state: WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants