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

Add flag to prevent "dist" folder from being deleted during ng build #5925

Closed
DanWahlin opened this issue Apr 11, 2017 · 5 comments · Fixed by #6186
Closed

Add flag to prevent "dist" folder from being deleted during ng build #5925

DanWahlin opened this issue Apr 11, 2017 · 5 comments · Fixed by #6186
Assignees
Labels
effort1: easy (hours) freq1: low Only reported by a handful of users who observe it rarely P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent severity2: inconvenient

Comments

@DanWahlin
Copy link

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x ] feature request

Versions.

@angular/cli: 1.0.0
node: 6.10.2
Same result as below for Windows or OSX

Repro steps.

I'm hooking up a Docker nginx container to the "dist" folder through a volume with the following command. Note that $(pwd) would represent the dist folder in this case (the working folder):

docker run -d -p 8080:80 -v $(pwd):/usr/share/nginx/html nginx:alpine

Hitting http://localhost:8080 works fine and the CLI sample app code/bundles in the dist folder work fine and are displayed in the browser.

However, if I run ng build again the dist folder seems to be deleted which then breaks the Docker container volume (since the original host folder that the container volume pointed to is now changed) and nginx will give a 404. I've sh'd into the nginx container and verified that the "html" folder isn't found (which means the "dist" folder isn't found probably due to the volume link breaking - that's what I suspect anyway). For devs wanting to work with "real" servers (nginx, Apache, HAproxy, etc.) to do updates to the CLI generated source code via Docker containers and volumes this presents a challenge.

The log given by the failure.

No failure in the CLI. The failure occurs with the Docker volume created between the nginx container and the dist folder on the host machine. Deleting the dist folder seems to be breaking the docker container volume link.

Desired functionality.

It would be nice to either leave the dist folder there and only delete the contents when performing a new "ng build" or to provide a flag that would allow us to leave the dist folder there for this type of scenario.

Mention any other details that might be useful.

Repo that runs this scenario plus several other containers can be found at https://github.com/DanWahlin/Angular-Docker-Microservices.

If you perform the steps listed in the readme it should fire up fine the first time. But, if you run an ng build again, the dist folder is deleted which seems to break the Docker volume link and nginx will then give a 404 since the original host folder was removed (at least I think that's why it's breaking).

@Kaffiend
Copy link

Could we just have a flag for overwrite dist content and a proxy for live reload?

@dave11mj
Copy link
Contributor

Wow ~ this ticket is describing exactly what I was going through the other day ! xD

I would second the motion of not deleting the dist and delete only its content or adding a flag to not delete it, and just overwrite since it makes adding volumes directly to it a lot trickier..

@aSegatto
Copy link

+1

@filipesilva filipesilva added effort1: easy (hours) freq1: low Only reported by a handful of users who observe it rarely P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent severity2: inconvenient labels May 3, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 4, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 4, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 5, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 5, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 8, 2017
@DanWahlin
Copy link
Author

I didn't get the message that the --delete-output-path flag was added for this scenario....thanks! Appreciate it.

dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this issue Apr 23, 2018
@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 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort1: easy (hours) freq1: low Only reported by a handful of users who observe it rarely P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent severity2: inconvenient
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants