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

Dockerfile #563

Closed
wants to merge 12 commits into from
Closed

Dockerfile #563

wants to merge 12 commits into from

Conversation

manbearwiz
Copy link

Sorry for the commit mess. Thankfully github is good at summarizing. That's just me not knowing how PRs and forks work with github yet.

This dockerfile uses the "trusted" Node.js Build and the latest release tarball. I suppose it could clone from git if that is prefered, but I think it makes more sense to use the released version as that is less likely to break on some random day.

$ sudo docker build -t benweet/stackedit
$ sudo docker run -d -p 3000:3000 --name stackedit benweet/stackedit

@benweet
Copy link
Owner

benweet commented Oct 11, 2014

Is it necessary to hard code the version number?

@manbearwiz
Copy link
Author

There are a few ways to get around this; none of which seem perfect.

  1. ENV $VARIABLES

    Looking at this issue It looks like once Docker 1.3 is released, I can do this:

    ENV STACKEDIT_VERSION 4.1.1
    
    RUN wget -qO- https://github.com/benweet/stackedit/archive/v${STACKEDIT_VERSION}.tar.gz | tar xz
    
    WORKDIR stackedit-${STACKEDIT_VERSION}
    

    This allows users to easily select an alternate version:

    sudo docker run -d --env STACKEDIT_VERSION=4.1.1 -p 3000:3000 --name stackedit benweet/stackedit`
    

    However the version should still be updated when there is a new release.

  2. Static URL
    If the latest release tarball was hosted at a static url, ex. https://stackedit.io/source.tar.gz, it wouldn't rely on release names. However this would mean more traffic for your site and still needing to update said archive file.

  3. Latest tag
    I could use git to find and clone the latest tag. This would mean installing git and prove troublesome if you tag a non release version, alpha, rc, etc.

@manbearwiz
Copy link
Author

Thinking about this a bit, I really think option 1 above makes the most sense. You should still update the version on new releases; however, it wouldn't be urgent, as users can easily pick any tagged version they want at run time. Also with a little modification I can make it work on the current version of docker

FROM dockerfile/nodejs

ENV STACKEDIT_VERSION 4.1.1

WORKDIR /tmp

RUN \
  wget -qO- https://github.com/benweet/stackedit/archive/v${STACKEDIT_VERSION}.tar.gz | tar xz && \
  mv stackedit-${STACKEDIT_VERSION} stackedit

WORKDIR stackedit

RUN \
  npm install && \
  node_modules/bower/bin/bower install --allow-root --production --config.interactive=false

CMD node server.js

EXPOSE 3000

Thoughts?

@manbearwiz
Copy link
Author

I'm going to close this PR and start new. I think I've got a solution to this figured out, and if it pans out I'll create a new PR from that.

@manbearwiz manbearwiz closed this Oct 29, 2014
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.

None yet

2 participants