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

feat(dist:Dockerfile): initial add dist Dockerfile #1639

Closed

Conversation

JeremyMarshall
Copy link
Collaborator

Add functionality to add Dockerfile to dist folder
in the same way as the heroku Procfile is created
No docker integration to build image

Closes #1531

@JeremyMarshall
Copy link
Collaborator Author

Further information

This needs a docker hub entry which I created https://hub.docker.com/r/generatorangularfullstack/angular-fullstack-dist/
which tracks on the release number (3.3.0 for the moment)
I'm happy to give control of this away. it pulls from a github repo which is just an npm install for the base dependencies - I guess these are fluid based on new releases

@Awk34
Copy link
Member

Awk34 commented Feb 17, 2016

Would it instead make more sense to just keep the Dockerfile within this repo? Then we wouldn't have any issues with versioning and dependencies.

@JeremyMarshall
Copy link
Collaborator Author

I rebuilt the dockerfile repo to https://github.com/angular-fullstack/angular-fullstack-dockerfile but I can't change the docker hub repo to https://hub.docker.com/r/generatorangularfullstack/angular-fullstack-dist/ point to it as I'm not an admin on the github repo used to build it. I added @Awk34 as an admin in hub.docker and hopefully you can fix this problem, probably by deleting and recreating the repo.

As for the dependencies, I was thinking there would be images built for every version released to avoid bit rot for apps built with older versions. This works by branching the source repo and adding it in in hub.docker https://hub.docker.com/r/generatorangularfullstack/angular-fullstack-dist/~/settings/automated-builds/

@macneib
Copy link
Contributor

macneib commented May 9, 2016

Referencing hub.docker.com can be problematic for several reasons. The way I use a dockerfile is still kind of a pain to use because during automated builds the npm/bower process needs to be run inside the container instead of simply copying in the modules. As you can see in the script: the npm install--production is run, however the bower modules are just automatically added, or something confusing like that.

This dockerfile needs to be run from /dist after grunt build:dist so it needs to be copied in, and then executed as such:

docker build -t="myAwesomeApp" .

I usually keep a Dockerfile like this in a project repo. It uses Alpine linux and therefore is pretty small. You can run docker-squash (https://github.com/jwilder/docker-squash) to get it even smaller if need be. Smallest I've gotten with my setup is ~82MB.

#
# angular-fullstack runtime Dockerfile
#

FROM alpine:latest

MAINTAINER "admin <[email protected]>"

WORKDIR /app
ADD . /app

RUN apk update && \
    apk upgrade && \
    apk add make gcc g++ python git nodejs && rm -rf /var/cache/apk/* && \
    echo '{ "allow_root": true }' > /root/.bowerrc && \
    npm install --production && \
    apk del make gcc g++ python git && \
    rm -rf /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp

# Expose ports.
EXPOSE 8080

CMD ["npm", "start"]

@Awk34
Copy link
Member

Awk34 commented May 11, 2016

@JeremyMarshall sorry it's been so long. Do you have any time to revisit this? Perhaps respond to @macneib 's comments?

@JeremyMarshall
Copy link
Collaborator Author

You can't fault the tiny size with this approach. I think there could be room for different Dockerfiles.
I was aiming to use the official Node Docker stack and preload the standard npm dependencies. With this it would rebuild on the docker hub infrastructure. It does need some way of keeping in step with the main generator repo though.
The changes to add the dockerfile in on their own will allow the Dockerfile to survive in the dist folder which can allow flexibility and not have to worry about re-adding the file

Possibly the approach is just to provide a standard node Dockerfile to get projects started @macneib is correct, the npm dependencies are a pain as they need to be rebuilt every time (hopefully from the cache) unless there is an intermediate image with them pre added

@Awk34
Copy link
Member

Awk34 commented May 12, 2016

You can also take a look at what #938 is doing

@JeremyMarshall
Copy link
Collaborator Author

I see you closed it. I was going to put docker compose in in a separate PR
and possibly docker cloud (previously tutum)

The point about the environment is to connect node to mongo inside the
running docker using compose or docker when linking manually

On Thu, May 12, 2016 at 11:39 PM, Andrew Koroluk [email protected]
wrote:

You can also take a look at what #938
#938
is doing


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#1639 (comment)

@Awk34
Copy link
Member

Awk34 commented May 13, 2016

Well, that old PR is quite outdated, and the original author won't be updating it, that's why It'd be great if you could do that stuff as well 😄

@Awk34
Copy link
Member

Awk34 commented May 13, 2016

I've given you write access, so you can make a branch directly on this repo

@JeremyMarshall
Copy link
Collaborator Author

JeremyMarshall commented Jun 3, 2016

Closed to refactor with latest changes - seems I force pushed my repo from canary which was the one I did the original PR on. Will put it on a separate docker branch - I still have the changes on a different branch

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

Successfully merging this pull request may close these issues.

3 participants