-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from joez/develop
release v0.6
- Loading branch information
Showing
8 changed files
with
70 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
/MYMETA.* | ||
/ext | ||
/bin/cpanm | ||
Dockerfile* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,37 @@ | ||
FROM perl:5.24 | ||
|
||
MAINTAINER Joe Zheng | ||
# docker run -it -v $(pwd):/work -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) ptk | ||
LABEL author=joez | ||
|
||
COPY . /var/ptk | ||
RUN echo 'source /var/ptk/envsetup' >> ~/.bashrc && exec bash --login | ||
# deploy gosu | ||
RUN set -eux; \ | ||
arch=$(dpkg --print-architecture | awk -F- '{ print $NF }'); \ | ||
base="https://github.com/tianon/gosu/releases/download"; \ | ||
version=1.12; \ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ | ||
wget -O /usr/local/bin/gosu "${base}/${version}/gosu-${arch}"; \ | ||
wget -O /usr/local/bin/gosu.asc "${base}/${version}/gosu-${arch}.asc"; \ | ||
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ | ||
gpgconf --kill all; \ | ||
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ | ||
chmod +x /usr/local/bin/gosu; \ | ||
gosu --version; \ | ||
gosu nobody true | ||
|
||
# deploy ptk | ||
COPY . /opt/ptk | ||
RUN ["/bin/bash", "-c", "source /opt/ptk/envsetup"] | ||
|
||
# add user, its uid/gid will be modified by docker-entry later | ||
RUN groupadd -g 1000 -r joe \ | ||
&& useradd -u 1000 -l -m -r -g joe -s /bin/bash -d /home/joe joe | ||
RUN echo 'source /opt/ptk/envsetup' >> /home/joe/.bashrc | ||
|
||
# here is the workspace | ||
RUN mkdir -p /work && chown joe:joe /work | ||
VOLUME ["/work"] | ||
WORKDIR /work | ||
|
||
CMD ["bash"] | ||
ENTRYPOINT ["/opt/ptk/docker-entry"] | ||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# This allows the docker container manipulating files in the shared | ||
# volume owned by the USER_ID:GROUP_ID, e.g. | ||
# | ||
# docker run -it -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) ptk | ||
# | ||
# See also: https://github.com/moby/moby/issues/7198 | ||
|
||
# allow the container to be started with "--user" | ||
if [[ "$(id -u)" == '0' ]]; then | ||
# if the user is not specified, default as 1000:1000 | ||
[[ -z $USER_ID ]] && USER_ID=1000 | ||
[[ -z $GROUP_ID ]] && GROUP_ID=1000 | ||
|
||
NAME=joe | ||
|
||
echo "Modify uid/gid of $NAME to $USER_ID:$GROUP_ID" | ||
groupmod -g $GROUP_ID $NAME | ||
usermod -u $USER_ID $NAME | ||
chown -R $NAME:$NAME /home/$NAME | ||
|
||
exec gosu $NAME:$NAME "$@" | ||
else | ||
# do as-is as the user required | ||
exec "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
package Ptk; | ||
use Ptk::Base -base; | ||
|
||
our $VERSION = '0.5'; | ||
our $VERSION = '0.6'; | ||
|
||
1; | ||
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters