-
Notifications
You must be signed in to change notification settings - Fork 68
Add Docker support. #5
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .git* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| FROM python:3-alpine | ||
| MAINTAINER Tecnativa <info@tecnativa.com> | ||
| ENTRYPOINT ["/usr/src/app/entrypoint.sh"] | ||
| ENV GIT_AUTHOR_NAME=git-aggregator \ | ||
| EMAIL=https://hub.docker.com/r/tecnativa/git-aggregator | ||
| # HACK Install git >= 2.11, to have --shallow-since | ||
| # TODO Remove HACK when python:alpine is alpine >= v3.5 | ||
| RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.5/main git | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yajo Hrmmmm so remember when I reported that this didn't work in the Odoo Docker container? Well it works here. I took it a step further and created a dockerfile with just this in it, and it still worked. My curiosity is peaked, so I'll probably fool around with this a bit more in that context. |
||
| COPY . /usr/src/app | ||
| RUN pip install --no-cache-dir --editable /usr/src/app | ||
| RUN python -m compileall /usr/src/app/ | ||
| VOLUME /repos | ||
| WORKDIR /repos | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/bin/sh | ||
|
|
||
| # Default to the gitaggregate command if we get an option as first argument | ||
| if [ "${1:0:1}" == - ]; then | ||
| cmd="gitaggregate $@" | ||
| else | ||
| cmd="$@" | ||
| fi | ||
|
|
||
| # Add SETUID & SETGUID to binaries to make them run with the same user as | ||
| # `/repos`'s owner. In case you mount `/repos` from your host computer. This is | ||
| # useful because otherwise all files and folders would be owned by `root`. | ||
| uid=$(stat -c %u /repos) | ||
| if [ $uid -ne $(id -u root) ]; then | ||
| gid=$(stat -c %g /repos) | ||
| addgroup -g $gid threpwood | ||
| adduser -G threpwood -u $uid guybrush -DH -s /bin/sh | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Absolutely 😆 All that matters is the UID & GID, so I had to put some name and that one came to my mind ☠️
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious, mainly due to my newness in Docker arena- if you use a user that exists on the host system, are the GID and UID matched with the system user/group of the same name?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's why this hack, it allows you to use the docker app and let it use your same user permissions. So after cloning, no root-owned files are there.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome thanks for the elaboration! I've been running into permissions issues lately & I have no idea why this never dawned on me 😄 |
||
|
|
||
| exec su guybrush -c "$cmd" | ||
| else | ||
| exec "$cmd" | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tecnativa repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because this code builds https://hub.docker.com/r/tecnativa/git-aggregator/, and I don't want to address people to Acsone until they acknowledge maintenance of this image (in which case it would become https://hub.docker.com/r/acsone/git-aggregator/ or something similar). That's why I said what I said in #5 (comment).